How can I enumerate over types exported by mscorlib.dll on .NET 5.0?
I'm familiar with System.Reflection
in general, and for assemblies that I create, and non-framework assemblies in general, Assembly.GetExportedTypes()
returns the results I expect. However if I call this method on an instance of Assembly
pointing at mscorlib.dll, then it returns no types. The types are actually there - Assembly.GetType("System.Int32")
for example returns what you'd expect - but GetExportedTypes()
doesn't return this, or any other type.
I'm doing this on .NET 5.0 on Linux. I've tried disassembling mscorlib.dll and I can see that a lot (all?) of the type definitions are actually just forwards to definitions in netstandard.dll, but netstandard.dll apparently contains no enumerable exports either.
I specifically need to enumerate all public types in mscorlib (and System.Runtime etc.) to provide support for symbol search and code completion in a Visual Studio Code extension, so it's not sufficient to get types individually and explicitly by name - I need to see all public types in framework assemblies without knowing what's in them ahead-of-time.
Thanks
Aucun commentaire:
Enregistrer un commentaire