lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] Shazwazza commented on issue #305: Investigate how we can load external assemblies when running Lucene.Net.Benchmarks on the command line
Date Tue, 06 Oct 2020 14:40:41 GMT

Shazwazza commented on issue #305:
URL: https://github.com/apache/lucenenet/issues/305#issuecomment-704315848


   oh yes my bad, i was confused with the benchmarkdotnet project(s) that we have, this one
is different.
   
   > Since the commands are essentially run-once I don't believe there will be any issues
with "unloading" to worry about.
   
   If its for netcore 3 then AssemblyLoadContext is still the way to do it whether you unload
or not. This is a nice post about it https://codetherapist.com/blog/netcore3-plugin-system/
If it's not netcore 3 then you can use Assembly.Load(name) if you want it loaded correctly
(with fusion) but then the assembly needs to be in your probing paths (i.e. /bin), else you
can load with Assembly.LoadFrom(filename) or Assembly.Load(bytes) but if you do that, the
assembly will not be loaded in the same context. This is all different depending on the platform
you are running on. In Net Framework this is all super ugly and you need to know about the
3 load contexts: Default, Load-From, No Context, see https://docs.microsoft.com/en-us/dotnet/framework/deployment/best-practices-for-assembly-loading
but basically dealing with anything but the Default is a pain and you will almost always need
an AppDomain.AssemblyResolve event, but you might get success with LoadFrom
   
   netcore has fixed all this nonsense :) so depends on what it needs to run on


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message