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

AssemblyGenerator fails when generating bytes for 'System.Private.CoreLib' in .NET 8.0 #178

Open
Heptagram64 opened this issue Jun 21, 2024 · 1 comment

Comments

@Heptagram64
Copy link

Heptagram64 commented Jun 21, 2024

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
Copy link
Author

Heptagram64 commented Jun 21, 2024

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

@Heptagram64 Heptagram64 changed the title AssemblyGenerator fails when generating bytes for 'System.Private.CoreLib' AssemblyGenerator fails when generating bytes for 'System.Private.CoreLib' in .NET 8 Jun 25, 2024
@Heptagram64 Heptagram64 changed the title AssemblyGenerator fails when generating bytes for 'System.Private.CoreLib' in .NET 8 AssemblyGenerator fails when generating bytes for 'System.Private.CoreLib' in .NET 8.0 Jun 25, 2024
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

1 participant