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# Custom Options: TypeInitializationException: InnerException: An item with the same key has already been added #7174
Comments
Accidentally closed issue thinking it was not reproing. It repros for me 100%. |
Something is definitely wrong here... This issue should be fixed by 34f9497 and a release has been made since that commit was added however decompiling the 3.11.3 release on nuget shows that it hasn't actually been updated. Any idea why this might be @jtattermusch @rafi-kamal? |
Looks like the commit wasn't backported to the release branch (3.11.x). |
Given that this makes any use of reflection infeasible for some protos, I think this really merits a 3.11.4 release. |
#7188 to backport the fixes to the release branch. |
We have the same problem. Will the new version be released soon? @rafi-kamal |
We are planning to do the 3.11.4 release by the end of this week. |
Thx! |
Should be fixed by #7188. |
What version of protobuf and what language are you using?
Version: master/v3.11.2.0
Language: C#
What operating system (Linux, Windows, ...) and version?
Windows
What runtime / compiler are you using (e.g., python version or gcc version)
GoogleProtobuf.Tools.3.11.2
What did you do?
Steps to reproduce the behavior:
Create a FieldOption in ObjectReference.proto:
Then use that field option in two places. First, Blah.proto:
And Blah2.proto:
Create a message that uses both of those call it Configuration.proto:
Compile to C# and just print Configuration.Descriptor.FullName. Doing so will trigger the "An item with the same key has already been added" exception.
What did you expect to see
No error. Should be able to use the same Field Option in 2 places.
What did you see instead?
TypeInitializationException.
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Anything else we should know about your project / environment
If you remove one of the ObjectReferenceType field options from one of the fields as well as it's import, the exception goes away. It only happens if two separate fields have field options and two separate files import the FieldOption extension.
The text was updated successfully, but these errors were encountered: