[Azure.Anaytics.Synapse.Artifacts] Deserialization exception from CodeModel.yaml
See original GitHub issue@annelo-msft commented on Thu Aug 05 2021
I am trying to generate code for the Azure.Anaytics.Synapse.Artifacts
from an updated autorest.md
file pointing to the service team’s new preview swagger:
(i.e. this API Spec with the tag package-artifacts-2021-06-01-preview
)
I am getting the following exception:
YamlDotNet.Core.YamlException: ‘(Line: 51548, Col: 11, Idx: 3358409) - (Line: 51548, Col: 11, Idx: 3358409): Exception during deserialization’
YamlDotNet.Core.YamlException
HResult=0x80131500
Message=(Line: 51548, Col: 11, Idx: 3358409) - (Line: 51548, Col: 11, Idx: 3358409): Exception during deserialization
Source=YamlDotNet
StackTrace:
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t)
at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func3 nestedObjectDeserializer, Object& value) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t) at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func
3 nestedObjectDeserializer, Object& value)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t)
at YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.DeserializeHelper(Type tItem, IParser parser, Func3 nestedObjectDeserializer, IList result, Boolean canUpdate) at YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func
3 nestedObjectDeserializer, Object& value)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t)
at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func3 nestedObjectDeserializer, Object& value) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer) at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t) at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func
3 nestedObjectDeserializer, Object& value)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type)
at YamlDotNet.Serialization.Deserializer.Deserialize[T](IParser parser)
at YamlDotNet.Serialization.Deserializer.Deserialize[T](TextReader input)
at YamlDotNet.Serialization.Deserializer.Deserialize[T](String input)
at AutoRest.CSharp.Input.CodeModelSerialization.DeserializeCodeModel(String yaml) in C:\src\autorest.csharp\src\AutoRest.CSharp\Common\Input\CodeModelSerialization.cs:line 52
This exception was originally thrown at this call stack: System.Convert.ChangeType(object, System.Type, System.IFormatProvider) YamlDotNet.Serialization.Utilities.TypeConverter.ChangeType(object, System.Type, System.Globalization.CultureInfo) YamlDotNet.Serialization.Utilities.TypeConverter.ChangeType(object, System.Type) YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.DeserializeHelper(System.Type, YamlDotNet.Core.IParser, System.Func<YamlDotNet.Core.IParser, System.Type, object>, System.Collections.IList, bool) YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(YamlDotNet.Core.IParser, System.Type, System.Func<YamlDotNet.Core.IParser, System.Type, object>, out object) YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(YamlDotNet.Core.IParser, System.Type, YamlDotNet.Serialization.Utilities.SerializerState, YamlDotNet.Serialization.IValueDeserializer)
Inner Exception 1: InvalidCastException: Object must implement IConvertible.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (12 by maintainers)
Top GitHub Comments
Yeah I can easily repro with this simple spec with an allOf that is a
string
Will see what validation I can add here.
For your use case though why did you change the type? Is this necessary?
So this seems to be due to this directive:
which change the type of DatasetCompression to string and I guess some other schema have allOf reference to it which cause issue as it can’t be extending a string.
Now I a not sure why modelerfour doesn’t complain before about that, will look into it.