Is it safe to use all the time config.PreferSharedTypes to true in using pluginloader?
kgorro opened this issue · comments
A dotnet profiler is dynamically loading an assembly which uses types that reference might causes system.io.fileload exception.
Is it recommended to use config.PreferSharedTypes = true ? Or Is it possible to have a feature which you can specify a config to exclude an assembly to be loaded in default load context?
"safe" is an ambiguous term here, so not sure how to answer. That said, take a look at what PluginLoader
is doing under the hood. I chose two sets of behaviors that I thought were sensible defaults. I also provided a lower-level API called AssemblyLoadContextBuilder
which allows you finer grained control to define your own loading behaviors. For example, checkout
DotNetCorePlugins/src/Plugins/Loader/AssemblyLoadContextBuilder.cs
Lines 114 to 195 in 11cdc4d
The issue is when we tried to use the plugin loader with a dotnet profiler which loaded an assembly dynamically causes the application to crash. The main reason for this is that the assembly being loaded by the dotnet profiler is also being loaded by the plugin loader. To solve this we use config.PreferSharedTypes = true
This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please comment if you believe this should remain open, otherwise it will be closed in 14 days. Thank you for your contributions to this project.
Closing due to inactivity.
If you are looking at this issue in the future and think it should be reopened, please make a commented here and mention natemcmaster so he sees the notification.