❔ Help with Assemblies and the TypeRef table
I am trying to load a .NET DLL as an assembly and read the TypeRef table. End goal is to get all the TypeNames and their corresponding NameSpaces.
The image shows all the results I should get, but I am only getting one result "Program". Code provided
6 Replies
not sure if it''s all of your problem, but 'get exported types' are only public types. Try
GetTypes()
instadyou cannot get this information using System.Reflection
reflection lets you look at type and member definitions. there is no API that gets you all of the types referenced in the DLL
you need to use a raw metadata reader like System.Reflection.Metadata (completely different API from System.Reflection) for that
Ok so I should look into System.Reflection.Metadata? I can probably learn that and implement it into my code. Thank you
I tried this as well, per @reflectronic 's answer I think I need a new API
yes. you should probably start from https://learn.microsoft.com/en-us/dotnet/api/system.reflection.metadata.metadatareader?view=net-7.0
MetadataReader Class (System.Reflection.Metadata)
Reads metadata as defined by the ECMA 335 CLI specification.
Awesome, thank you
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.