runtime: System.Reflection.MetadataLoadContext doesn't support function pointer types

To reproduce: run the attached project Version: master Expected result: works Actual result:

Unhandled exception. System.NotSupportedException: Parsing function pointer types in signatures is not supported.
   at System.Reflection.TypeLoading.Ecma.EcmaModule.GetFunctionPointerType(MethodSignature`1 signature)
   at System.Reflection.Metadata.Ecma335.SignatureDecoder`2.DecodeType(BlobReader& blobReader, Boolean allowTypeSpecifications, Int32 typeCode)
   at System.Reflection.Metadata.Ecma335.SignatureDecoder`2.DecodeMethodSignature(BlobReader& blobReader)
   at System.Reflection.TypeLoading.Ecma.EcmaMethodDecoder.SpecializeMethodSig(IRoMethodBase roMethodBase)
   at System.Reflection.TypeLoading.RoDefinitionMethod`1.ComputeMethodSig()
   at System.Reflection.TypeLoading.RoMethod.get_MethodSig()
   at System.Reflection.TypeLoading.RoMethod.get_ReturnParameter()
   at System.Reflection.TypeLoading.RoMethod.get_ReturnType()

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 18 (18 by maintainers)

Most upvoted comments

It should be possible to use .NET framework with MetadataLoadContext function pointers although reflection will necessary to call the new APIs on Type. I’ll provide an example once that PR is in.

We may want to provide extension methods so that it is not necessary to use reflection.