-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guid type causes KeyNotFoundException in calls to CreateDeserializerOnly<T> or CreateGenericDeserializerOnly #987
Comments
…e record type.
It looks like it has to do with multiple Guid members in a class causing JsonSchemaBuilder to the schema incorrectly. Given the following class:
A call to AvroSerializer.CreateDeserializerOnly will fail with a KeyNotFoundException. The following test case demonstrates that:
|
@sokhalsa Thank you for the feedback. Assigned to the appropriate team |
Was anything ever done with this? It's still open 2 years later. |
please reopen if this is still an issue. |
Looks like it wasn't fixed. Reproduces in Microsoft.Hadoop.Avro2 1.2.1 and microsoft.hadoop.avro-core 1.1.19. And I don't see Microsoft.Hadoop.Avro in azure-sdk-for-net now. |
When attempting to call AvroSerializer.CreateDeserializerOnly or AvroSerializer.CreateGenericDeserializerOnly with a writer schema for a type that contains a Guid, a KeyNotFoundException ("The given key was not present in the dictionary.") error is thrown in JsonSchemaBuilder.CreatePrimitiveTypeSchema because "System.Guid" is not a key in the PrimitiveRuntimeType dictionary.
The stack trace is:
at System.Collections.Generic.Dictionary
2.get_Item(TKey key) at Microsoft.Hadoop.Avro.Schema.JsonSchemaBuilder.CreatePrimitiveTypeSchema(String type, Dictionary
2 attributes) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\Schema\JsonSchemaBuilder.cs:line 410at Microsoft.Hadoop.Avro.Schema.JsonSchemaBuilder.ParsePrimitiveTypeFromString(String token) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\Schema\JsonSchemaBuilder.cs:line 382
at Microsoft.Hadoop.Avro.Schema.JsonSchemaBuilder.Parse(JToken token, NamedSchema parent, Dictionary
2 namedSchemas) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\Schema\JsonSchemaBuilder.cs:line 105 at Microsoft.Hadoop.Avro.Schema.JsonSchemaBuilder.ParseRecordField(JObject field, NamedSchema parent, Dictionary
2 namedSchemas, Int32 position) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\Schema\JsonSchemaBuilder.cs:line 349at Microsoft.Hadoop.Avro.Schema.JsonSchemaBuilder.<>c__DisplayClass3.b__2(JToken field, Int32 index) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\Schema\JsonSchemaBuilder.cs:line 318
at System.Linq.Enumerable.d__7
2.MoveNext() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)at Microsoft.Hadoop.Avro.Schema.JsonExtensions.ReadArrayProperty[T](JToken token, String propertyName, Boolean isOptional, Func
3 func) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\Schema\JsonExtensions.cs:line 195 at Microsoft.Hadoop.Avro.Schema.JsonExtensions.OptionalArrayProperty[T](JToken token, String propertyName, Func
3 func) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\Schema\JsonExtensions.cs:line 78at Microsoft.Hadoop.Avro.Schema.JsonSchemaBuilder.ParseRecordType(JObject record, NamedSchema parent, Dictionary
2 namedSchemas) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\Schema\JsonSchemaBuilder.cs:line 309 at Microsoft.Hadoop.Avro.Schema.JsonSchemaBuilder.ParseJsonObject(JObject token, NamedSchema parent, Dictionary
2 namedSchemas) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\Schema\JsonSchemaBuilder.cs:line 140at Microsoft.Hadoop.Avro.Schema.JsonSchemaBuilder.Parse(JToken token, NamedSchema parent, Dictionary`2 namedSchemas) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\Schema\JsonSchemaBuilder.cs:line 88
at Microsoft.Hadoop.Avro.Schema.JsonSchemaBuilder.BuildSchema(String schema) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\Schema\JsonSchemaBuilder.cs:line 71
at Microsoft.Hadoop.Avro.AvroSerializer.CreateForCore[T](String writerSchema, AvroSerializerSettings settings) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\AvroSerializer.Static.cs:line 177
at Microsoft.Hadoop.Avro.AvroSerializer.CreateDeserializerOnly[T](String writerSchema, AvroSerializerSettings settings) in d:\Git\WindowsAzure\azure-sdk-for-net\src\HDInsight\Microsoft.Hadoop.Avro\AvroSerializer.Static.cs:line 98
The text was updated successfully, but these errors were encountered: