AssemblyGenerator fails when generating bytes for 'System.Private.CoreLib' in .NET 8.0
Heptagram64 opened this issue · 1 comments
Heptagram64 commented
For as far as i have used this, AssemblyGenerator.GenerateAssemblyBytes() seems to work for most assemblies present in application memory, but unfortunately not for 'System.Private.CoreLib'.
It specifically throws;
System.ArgumentException: 'Type cannot be found: "System.Runtime.CompilerServices.RefSafetyRulesAttribute, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" Arg_ParamName_Name'
in GetTypeHandle() of AssemblyMetadata.cs
I suppose this is a bug?
Heptagram64 commented
Just realized that GetTypeHandle() is a microsoft function
Looking at the IL from my debugger i think the exception actually mapped to line 35 in CreateCustomAttributes() of AssemblyGenerator.Attributes.cs