[ 
https://issues.apache.org/jira/browse/AVRO-2499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16940491#comment-16940491
 ] 

Hudson commented on AVRO-2499:
------------------------------

SUCCESS: Integrated in Jenkins build AvroJava #741 (See 
[https://builds.apache.org/job/AvroJava/741/])
AVRO-2499: Cache classes referenced in a union for C# reflect API (#652) 
(blachniet: 
[https://github.com/apache/avro/commit/0fe596a123d03e3a2ada9d34a79685bc9d4be9de])
* (edit) lang/csharp/src/apache/main/Reflect/ClassCache.cs
* (edit) lang/csharp/src/apache/main/Reflect/README.md
* (edit) lang/csharp/src/apache/test/Reflect/TestReflect.cs
* (edit) lang/csharp/src/apache/test/Reflect/TestFromAvroProject.cs
* (add) lang/csharp/src/apache/test/Reflect/TestUnion.cs


> C# reflect does not cache classes referenced in a union
> -------------------------------------------------------
>
>                 Key: AVRO-2499
>                 URL: https://issues.apache.org/jira/browse/AVRO-2499
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: csharp
>            Reporter: Patrick Farry
>            Priority: Major
>             Fix For: 1.10.0
>
>
> In the example below an attempt to serialize an object of type A fails.
> { "name" : "A", 
>    "type" " : "record",
>    "fields" : [
>         { "name" : "OptionalProperty",
>            "type" : [ "null",
>                           { "name" : "B",
>                              "type" : "record",
>                              "fields" : [ "name" : "C", "type" : "string" ]
>                            }
>                       ]
>         }
> } 
>  
>  
>  
> C# classes
> public class A {
>     public B OptionalProperty \{ get; set;}
> }
> public class B {
>     public string C \{ get; set;}
> }
>  
>  
> Problem is in Reflect/ClassCache.cs line 259.
> Need to add the following case
> case UnionSchema us:
>     foreach (var o in us.Schemas)
>     {
>         if (o.Tag!=Avro.Schema.Type.Null)
>         {
>             LoadClassCache(objType, o);
>         }
>     }
>  
> Will do a PR 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to