-
Notifications
You must be signed in to change notification settings - Fork 322
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
C# - Failed to serialize a class with nullable generic field inherited from base class #1024
Comments
Interesting. It's getting confused somewhere by the generic, the nullable, and the nullable inner type. (Somewhat related: Generation of C# serializer for a = nothing field with a default value fails with an obscure exception) |
I faced a similar problem. In my case I'm not using a generic value, instead I've a nullable field of an string alias:
StrAlias is defined as a struct (value type):
Serialization for Test object is failing with similar error:
|
These very well could be related. I wonder if it's the struct that's causing the expression generation to get confused. |
By looking a little bit more at the code: https://github.com/microsoft/bond/blob/master/cs/src/core/expressions/ObjectParser.cs Could be possible that it is missing the specific type while creating the constant? |
Could very well be the case. I don't have time for the foreseeable future to add a regression test and attempt a fix. If you're interested, feel free to play around here and submit a PR if you come up with a fix. |
Having the following schema:
I'm getting the following exception when trying to serialize an instance of a
Test
object:However, it works if I change the schema to:
The text was updated successfully, but these errors were encountered: