-
Notifications
You must be signed in to change notification settings - Fork 536
Generates invalid CSharp code when using sinceVersion attribute inside groups #543
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
Comments
message->group->composite
when attributed with sinceVersion
Thanks for the report @ZachBray. Can you try the latest to confirm it works for you? |
It looks much healthier now. Thank you! |
@billsegall, will this fix make it into the "sbe-tool" NuGet package or should I package it up myself for use on our project? |
I'll try and get a new package out this week. |
nuget.org has an update. Thanks for the report and patch. |
Great! Thank you for the package update. |
Hi guys, Sorry I've discovered another issue related to this. Not sure how I didn't notice it earlier. The code generated is now valid C# and it works for decoding. When encoding we use the same property. public SimpleCompositeV0 Value
{
get
{
if (_actingVersion < 42) return null;
_value.Wrap(_buffer, _offset + 0, _actingVersion);
return _value;
}
} Unfortunately I'll attach a PR that fixes this momentarily. |
Previously `_actingVersion` was not initialized upon a call to `WrapForEncode(...)`. This meant that access to properties on the group that allow the items to be encoded fails. Now we initialize it to the current schema version.
Fixes an issue associated with issue #543.
I've merged the change. However it feels wrong to wrapForEncode and then decode. I think the Java design of separate encoders and decoders is a safer and cleaner approach. |
FYI we're not calling
👍 |
Thanks for this great library! :-)
I think this is an issue for @billsegall, as it relates to the CSharp code generation.
We're generating code using the
sbe-tool:1.7.6
JAR.When we have the following structure in the schema file
the C# code that is generated does not compile.
This code fragment is representative of the problem:
If
actingVersion
were prefixed with an underscore I believe it would fix the issue.It looks like it may come from this line: https://github.com/real-logic/simple-binary-encoding/blob/4b64c6f4a678f6ccb5604c5f5e0b2cade3e5bfa2/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/csharp/CSharpGenerator.java#L700
Full schema
Generated class
The text was updated successfully, but these errors were encountered: