-
Notifications
You must be signed in to change notification settings - Fork 505
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
Update to latest protogen #628
Conversation
Codecov Report
@@ Coverage Diff @@
## master #628 +/- ##
==========================================
+ Coverage 23.59% 23.65% +0.05%
==========================================
Files 85 85
Lines 8709 8718 +9
Branches 719 719
==========================================
+ Hits 2055 2062 +7
- Misses 6523 6525 +2
Partials 131 131
Continue to review full report at Codecov.
|
I really don't like patching the binaries, and I don't think it will be maintainable going forwards. Can we follow the original suggestion from the other issue and have our own generator frontend that's more tailored for our use? |
The patch is a proof of concept, as it currently compiles steamkit but throws during serialisation. |
Okay, so I figured out why it failed to serialize with new protogen. It generates the following attribute for some properties:
And for whatever reason that makes protobuf-net fail to serialize it with Old protogen didn't generate that, updating protobuf-net doesn't fix it, so I suspect it's a bug. The following code throws, and removing
@mgravell Would you have any idea what could be going on here? |
Oof, yeah, that's just a huge number overflow. I'm *guessing* that adding
UL as a suffix to the number will fix it. Any chance you could test that
hypothesis? I can update protogen if it is that.
…On Wed, 23 Jan 2019, 13:30 Pavel Djundik ***@***.*** wrote:
Okay, so I figured out why it failed to serialize with new protogen. It
generates the following attribute for some properties:
[global::System.ComponentModel.DefaultValue(18446744073709551615)]
And for whatever reason that makes protobuf-net fail to serialize it with Arithmetic
operation resulted in an overflow.. I patched protogen so it no longer
generates that and it appears to work now.
Old protogen didn't generate that, updating protobuf-net doesn't fix it,
so I suspect it's a bug.
The following code throws, and removing ComponentModel.DefaultValue makes
it work again.
[global::ProtoBuf.ProtoMember(10, DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
[global::System.ComponentModel.DefaultValue(18446744073709551615)]
public ulong jobid_source
{
get { return __pbn__jobid_source ?? 18446744073709551615; }
set { __pbn__jobid_source = value; }
}
@mgravell <https://github.com/mgravell> Would you have any idea what
could be going on here?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#628 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABDsOMzQvpnXJNSQFvHP2tOYT714Npgks5vGGQRgaJpZM4aIfZp>
.
|
Adding EDIT: Doing |
K, I'll need to take a look at options, then. I guess at a push the
type+string overload might work. Sheesh, all more fun.
…On Wed, 23 Jan 2019, 14:02 Pavel Djundik ***@***.*** wrote:
Adding UL does not fix it, and I just checked, it passes the value into
DefaultValue(float) overload, as there doesn't appear to be any unsigned
overloads:
https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.defaultvalueattribute.-ctor?view=netframework-4.7.2
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#628 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABDsPMw3NRJVuid3sBNHCagxXZ2D5Obks5vGGtmgaJpZM4aIfZp>
.
|
Turns out protogen already had the underlying support for writing services, the c# generator simply didn't implement them. So I implemented the interface generation, it skips any options though, but it should be good enough for SteamKit. Technically speaking this is now fully compatible with SteamKit (I'm not sure if skipping DefaultValue will have any issues or not). |
@xPaw I'd be happy to look at a PR, if the service code would be more generally useful |
Yeah I made a PR in the protobuf repo. protobuf-net/protobuf-net#492 |
ah, k; I'll check that later; btw - if you don't want to keep having to upload binaries, all of the codegen code is available as a package ref to protobuf-net.Reflection - |
Well the Reflection binary is where all the patches are. |
Fixing We can't easily implement service generation ourselves (by subclassing We can do it, but with reflection hackery and duplicated code copied from from @mgravell Can we make those types/members part of public API, or do we have to upstream this, keeping in mind that it may conflict with / need to be switchable with gRPC as you mentioned in protobuf-net/protobuf-net#492? In the meantime I'm tempted to proceed with reflection... |
Closing in favor of #686 |
I patched protogen with the following:
Extensions
List<>
instead of arrays types to match current behaviourThe patch file is attached in the PR.
Things that need to be done:
DefaultValue
- DefaultValue() generated incorrectly for big ulong values protobuf-net/protobuf-net#495 Fix [DefaultValue(...)] with large uint64 value being interpreted as floating point protobuf-net/protobuf-net#516IPlayer
- Service interfaces are not generated with protogen protobuf-net/protobuf-net#487 Poor implementation of service interfaces in c# generator protobuf-net/protobuf-net#492