Git Product home page Git Product logo

Comments (7)

jduv avatar jduv commented on August 15, 2024

Hey Lorenz, thanks for the thoughts! I'll give this a look over the weekend--until then I think you're work around is perfectly fine. You could theoretically right your own path resolver and support whatever custom loading you want--but I'll think through your use case and see if I can get a more abstract solution. Appreciate the props, and let me know if you have any other troubles.

from appdomaintoolkit.

JoeBrockhaus avatar JoeBrockhaus commented on August 15, 2024

I'm glad I saw this: I'm implementing a plugin framework using this toolkit. (Why did it take me a week to find this!? I was rolling my own..) As contract types shared between calling app, interop assembly, the plugins drift over time (ie: plugin interface evolves, etc), presumably I'll need all the references loaded from the plugin's folder/workspace. But this seems to open a new can of worms: backward compatibility for plugins..

from appdomaintoolkit.

JoeBrockhaus avatar JoeBrockhaus commented on August 15, 2024

There's a pull request for changes I've made to support better extensibility without having to fork the project.

  1. AppDomainContext now requires 2 type parameters:
    a. TAssemblyTargetLoader (where : MarshalByRefObject, IAssemblyTargetLoader, new())
    b. TAssemblyResolver (where : MarshalByRefObject, IAssemblyResolver, new())
  2. IAssemblyResolver gets 2 new properties:
    a. string ApplicationBase
    b. string PrivateBinPath
  3. AppDomainContext sets these new properties rather than calling AddProbePath().
    (But in the same order as before)
  4. PathBasedAssemblyResolver implementation calls AddProbePath(value) in setter to maintain backward compatibility.
  5. New static AppDomainContext definition for no-hassle factory method definitions, also maintaining (most) backward compatibility. (**)

With this, we can create our own IAssemblyResolver that handles the ordering of the search paths (and their verification with DirectoryInfo, for example), plugging that type directly into the AppDomainContext. Previously, we would have to recreate the AppDomainContext as well.

Technically, I did not have to also expose TAssemblyTargetLoader to address this Issue, but felt it would be a good idea because others may indeed wish to extend that component. However, I stopped short of genericizing IAssemblyTargetLoader to allow piecemeal replacement of it's IAssemblyLoader component. I figured if you're going to replace one, it wouldn't be too much hassle to also replace the other (mostly since the code is available for them).

(**):
Type instance definitions will need to explicitly define the 2 new type parameters. To avoid this, I toyed with the idea of renaming the new generic type to something else and then just wrap the default-typed instance in a plain AppDomainContext. That would be fully backward compatible, but would either be a hassle or involve duplicating a lot of code and/or force AppDomainContext to be non-sealed.

from appdomaintoolkit.

jduv avatar jduv commented on August 15, 2024

Gentlemen,

Much appreciate all the work here. Pull request will be merged shortly.

from appdomaintoolkit.

JoeBrockhaus avatar JoeBrockhaus commented on August 15, 2024

very cool. thanks!
You may have already noticed, but I had to create a temp .snk, which you'll have to change back.
Does that also mean you'll push a new nuget version?

from appdomaintoolkit.

jduv avatar jduv commented on August 15, 2024

Yeah, I’ll do that later on today.

from appdomaintoolkit.

JoeBrockhaus avatar JoeBrockhaus commented on August 15, 2024

Awesome thanks :)

from appdomaintoolkit.

Related Issues (16)

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.