diff --git a/src/Microsoft.ML.OnnxTransformer/OnnxSequenceType.cs b/src/Microsoft.ML.OnnxTransformer/OnnxSequenceType.cs index c8b310b45c..1c2d5a77d8 100644 --- a/src/Microsoft.ML.OnnxTransformer/OnnxSequenceType.cs +++ b/src/Microsoft.ML.OnnxTransformer/OnnxSequenceType.cs @@ -56,9 +56,10 @@ public sealed class OnnxSequenceTypeAttribute : DataViewTypeAttribute { private Type _elemType; - /// - /// Create a sequence type. - /// + // Make default constructor obsolete. + // Use default constructor will left the _elemType field empty and cause exception in methods using _elemType. + // User will receive compile error when try to use [OnnxSequenceType] attribute directly without specify sequence type + [Obsolete("Please specify sequence type when use OnnxSequenceType Attribute", true)] public OnnxSequenceTypeAttribute() { } diff --git a/test/Microsoft.ML.Tests/OnnxSequenceTypeWithAttributesTest.cs b/test/Microsoft.ML.Tests/OnnxSequenceTypeWithAttributesTest.cs index e8090aef81..11849c3372 100644 --- a/test/Microsoft.ML.Tests/OnnxSequenceTypeWithAttributesTest.cs +++ b/test/Microsoft.ML.Tests/OnnxSequenceTypeWithAttributesTest.cs @@ -65,4 +65,4 @@ public void OnnxSequenceTypeWithColumnNameAttributeTest() } } -} +} \ No newline at end of file