1

In an AOT environment, NativeAOT reflection is something that can't be used (or at least it crashes for me, and they seem to suggest this is the case too). Is there an alternative way to utilize the library to deserialize proto messages?

I can use the raw proto library (as it has a static Parser) however there is a 2GB limit is a problem for this project.

gunr2171
  • 16,104
  • 25
  • 61
  • 88
RejectKid
  • 23
  • 2
  • What is the error that you get? Reflection works with NativeAOT, but it often requires rd.xml so the compiler know what to compile as it's method analysis is not enough to reveal dependenices via reflection. – S Waye Mar 12 '22 at 19:13
  • `Unhandled Exception: EETypeRva:0x00B5DB48(System.Reflection.MissingRuntimeArtifactException): MakeGenericMethod() cannot create this generic method instantiation because no code was generated for it: 'ProtoBuf.Serializers.RepeatedSerializer.CreateList()'. at System.Reflection.Runtime.MethodInfos.RuntimeNamedMethodInfo`1.GetUncachedMethodInvoker(RuntimeTypeInfo[], MemberInfo) + 0x1d6` – RejectKid Mar 15 '22 at 19:59
  • The compiler has not generated any code for that method. This is typically solved by adding that method to an rd.xml file. I don't have the exact syntax, but you read https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/reflection-in-aot-mode.md and https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/rd-xml-format.md – S Waye Mar 16 '22 at 22:05

0 Answers0