How can I do Assembly.ReflectionOnlyLoad in the .net core
I would like to do reflection only load, does not need to instantiate. How can I do it in .Net Core?
ReflectionOnlyLoads are not available in .NET Core. The recommended replacement is System.Reflection.Metadata.
What are you using reflection only loads for?
We use it to get all public types and properties in an assembly.
System.Reflection.Metadata should work. However, since we use Assembly interface in the legacy product, it will be major code changes to change from Full framework to .Net Core. To help customers migrate from existing applications, it will be great that you can support the existing API.
We will need to construct Type object from the metadata, and compare to the Type information serialized from a full framework service. Is there a reliable way to do it?
You can compare type name and maybe assembly name, depends on what you are trying to do. Note the type assemblies are different in .NET Core.
We will have to look for how the type object are used in the existing code all over the places and ensure we don't miss one.
I've tried to fully load the assembly and the Type object I've got from the assembly works. However, we cannot fully load the assembly in our real customer scenario.
Supporting ReflectionOnlyLoad will make the migration much easier.
This would help that but I doubt it'll happen in the near future https://github.com/dotnet/corefx/issues/2800
cc @AtsushiKan
CC @AlexGhiondea
Let's use https://github.com/dotnet/corefx/issues/2800 to track this
tl;dr https://github.com/dotnet/corefxlab/blob/master/docs/specs/typeloader.md