When writing a clr profiler, you may want to load a helper dll with helper classes.
Some others have asked about this, since it is a useful strategy, but answers didn't regard a lot of issues in these solution, for example:
Example 1- CLR profiler: issue in using DefineAssemblyRef
Example 2- https://github.com/dotnet/coreclr/issues/3894 (no actual solution given)
Overall, there are a few options that come in mind:
GAC - this is an ok solution, but it requires an installation step and some environments may not have GAC (azure, linux [with .net core]).
The other way is inject code that performs AssemblyResolve += Resembles what it says in example 1 - but that will lead to issues concerning transparent code calling the += code that is securityCritical etc... Or other issues regarding High / Medium / ... trust levels implemented in IIS for example, that might make it difficult to load this helper dll (even if it has a strong name).
Another big issue is that helper dll will be loaded to a specific AppDomain, as opposed to "EE Shared Assembly Registry". This can cause issues MultiDomainHost LoaderOptimization strategy, if dll references are injected to a GAC dll and appDomain containing helper dll is shutdown.
So what is the recommended way to load a helper dll from a clr profiler without GAC and avoid all of these issues?