Code Monkey home page Code Monkey logo

Comments (5)

dazinator avatar dazinator commented on July 30, 2024 1

ah ok.

Perhaps a better way forward for me then, is first shadow-copy the plugins from the IFileProvider to some temp physical directory first on startup, and then use dotnetcoreplugins to load them from there as normal. I can then IFileProvider.Watch for changes to plugins in the source at runtime and when they change, Unload the ALC, shadow copy again the new versions, and reload them with dotnetcoreplugins again. Should allow me to host plugins anywhere IFileProvider supports. Should also allow me to update the plugins at the source because they won't be locked by any process due to the addition of the shadow copy before load. I'll close this

from dotnetcoreplugins.

natemcmaster avatar natemcmaster commented on July 30, 2024

I don't think it's currently possible to do this. APIs this library calls in System.Runtime.Loader.AssemblyLoadContext requires file paths. Introducing a file provider abstraction means I would also need to know whether or not the file provider is physical or not....which IMO defeats the purpose of the abstraction.

from dotnetcoreplugins.

dazinator avatar dazinator commented on July 30, 2024

Could the load from stream method be used instead to load the assembly?

https://docs.microsoft.com/en-us/dotnet/api/system.runtime.loader.assemblyloadcontext.loadfromstream?view=netcore-2.2#System_Runtime_Loader_AssemblyLoadContext_LoadFromStream_System_IO_Stream_

I know this wouldn't cater for unmanaged / native libs.

Perhaps another possibility: When the ALC can't find an assembly at an expected path, I think it raises a resolve event to allow you to satisfy the resolution manually - perhaps here could be a good place to query from an IFileProvider?

from dotnetcoreplugins.

natemcmaster avatar natemcmaster commented on July 30, 2024

LoadFromStream might work, but LoadFromPath is optimized to handle on-disk assemblies better. LoadFromStream requires paging the entire assembly into memory.

And like you mentioned, this is only available for managed assemblies.

from dotnetcoreplugins.

natemcmaster avatar natemcmaster commented on July 30, 2024

Yeah, that sounds like a better approach.

from dotnetcoreplugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.