Skip to content
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

NullReferenceException in protobuf-net.Reflection 3.0.0-alpha.58 #563

Closed
yaakov-h opened this issue Oct 2, 2019 · 1 comment
Closed

Comments

@yaakov-h
Copy link
Contributor

yaakov-h commented Oct 2, 2019

Null reference occurs here: https://github.com/protobuf-net/protobuf-net/blob/master/src/protobuf-net.Core/ExtensibleUtil.cs#L59

Full details:

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=protobuf-net.Core
  StackTrace:
   at ProtoBuf.ExtensibleUtil.<GetExtendedValues>d__1.MoveNext() in C:\Code\protobuf-net\src\protobuf-net.Core\ExtensibleUtil.cs:line 59
   at ProtoBuf.ExtensibleUtil.<GetExtendedValues>d__0`1.MoveNext() in C:\Code\protobuf-net\src\protobuf-net.Core\ExtensibleUtil.cs:line 25
   at ProtoBuf.Extensible.TryGetValue[TValue](IExtensible instance, Int32 tag, DataFormat format, Boolean allowDefinedTag, TValue& value) in C:\Code\protobuf-net\src\protobuf-net.Core\Extensible.cs:line 178
   at ProtoBuf.Reflection.NameNormalizer.GetName(FieldDescriptorProto definition) in C:\Code\protobuf-net\src\protobuf-net.Reflection\NameNormalizer.cs:line 189
   at ProtoBuf.Reflection.CSharpCodeGenerator.WriteField(GeneratorContext ctx, FieldDescriptorProto field, Object& state, OneOfStub[] oneOfs) in C:\Code\protobuf-net\src\protobuf-net.Reflection\CSharpCodeGenerator.cs:line 621
   at ProtoBuf.Reflection.CommonCodeGenerator.WriteMessage(GeneratorContext ctx, DescriptorProto message) in C:\Code\protobuf-net\src\protobuf-net.Reflection\CodeGenerator.cs:line 278
   at ProtoBuf.Reflection.CommonCodeGenerator.WriteFile(GeneratorContext ctx, FileDescriptorProto file) in C:\Code\protobuf-net\src\protobuf-net.Reflection\CodeGenerator.cs:line 180
   at ProtoBuf.Reflection.CommonCodeGenerator.<Generate>d__16.MoveNext() in C:\Code\protobuf-net\src\protobuf-net.Reflection\CodeGenerator.cs:line 163
   at ProtobufGen.Program.Run(Options arguments) in D:\Users\Yaakov\Development\SteamKit\Resources\ProtobufGen\ProtobufGen\Program.cs:line 73
   at ProtobufGen.Program.Main(String[] args) in D:\Users\Yaakov\Development\SteamKit\Resources\ProtobufGen\ProtobufGen\Program.cs:line 22

This seems to be because TypeModel.DefaultModel is never initialized.

It seems to only ever be initialized by protobuf-net's RuntimeTypeModel, but attempting to use that from the new 3.0.0-alpha.174 package only results in MissingMethodExceptions, since the API surface of the various protobuf-net v3 packages don't seem to align.

@mgravell
Copy link
Member

this should be fixed in .75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants