more AssemblyNameInfo support in System.Reflection.Metadata #108226
Unanswered
KalleOlaviNiemitalo
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I was adapting my code to the ILVerification breaking change dotnet/docs#41786 in .NET 9, I was a bit surprised that the following API does not exist yet. I'm posting this as a discussion for now because this doesn't explain the use scenarios yet.
Difficulties in implementing similar methods in application code:
public static AssemblyNameInfo GetAssemblyNameInfo(this AssemblyReference assemblyReference)
would have to call assemblyReference.GetAssemblyName(), which unnecessarily creates a CultureInfo instance. It cannot directly construct an AssemblyNameInfo from the public properties of AssemblyReference because translatingStringHandle Name
to a String requires a MetadataReader and there's no public way to read theMetadataReader _reader
field of AssemblyReference.public static AssemblyNameInfo GetAssemblyNameInfo(MetadataReader reader, AssemblyReference assemblyReference)
would have to translate AssemblyFlags to AssemblyNameFlags, which looks a bit complex for AssemblyFlags.WindowsRuntime, and for AssemblyFlags.PublicKey in AssemblyDefinition.Beta Was this translation helpful? Give feedback.
All reactions