Add support for extension private deps#1369
Open
jtreminio wants to merge 7 commits intomcmonkeyprojects:masterfrom
Open
Add support for extension private deps#1369jtreminio wants to merge 7 commits intomcmonkeyprojects:masterfrom
jtreminio wants to merge 7 commits intomcmonkeyprojects:masterfrom
Conversation
mcmonkey4eva
reviewed
May 5, 2026
| public List<ExtensionInfo> KnownExtensions = []; | ||
|
|
||
| /// <summary>Per-extension load contexts, keyed by extension DLL name. Each extension gets its own <see cref="SwarmExtensionLoadContext"/> so private dependencies stay isolated from other extensions.</summary> | ||
| public ConcurrentDictionary<string, SwarmExtensionLoadContext> ExtensionLoadContexts = new(); |
Member
There was a problem hiding this comment.
Why is this a retained dict on its own? It doesn't look like there's any reuse, just a single grab on load
Contributor
Author
There was a problem hiding this comment.
Fair critique. I've reduced this further.
…ontext class; simplify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The way this works for me is, in my extension's
.csprojfile:I've added the ComfyTyped dep to two of my extensions, one with it fully baked in and used, the other with a very small footprint, swarmui builds fine.
This PR's purpose is for each extension to define its own private dependency, where ExtensionA and ExtensionB both depend on LibA but might be different versions.
The simpler solution that does not guard against multiple extensions using the same dependency that might have differing versions is changing
return Assembly.LoadFiletoreturn Assembly.LoadFromhere:Full disclosure as mentioned in Discord but important to note: This PR was created using Claude because C# build and dependency management confuses the heck out of me. I know the two proposed solutions work because I have a full test suite for my extensions, SwarmUI builds, and my extension with its private dependency works great.