Skip to content

Added support for loading referenced .dlls to the app domain in .NET Core#849

Open
Sergey-Vlasov wants to merge 4 commits into
masterfrom
WPFControl
Open

Added support for loading referenced .dlls to the app domain in .NET Core#849
Sergey-Vlasov wants to merge 4 commits into
masterfrom
WPFControl

Conversation

@Sergey-Vlasov
Copy link
Copy Markdown
Contributor

No description provided.

@Sergey-Vlasov Sergey-Vlasov requested a review from govert May 3, 2026 17:50
@Sergey-Vlasov Sergey-Vlasov changed the title Added support for loading referenced .dlls to the app domain Added support for loading referenced .dlls to the app domain in .NET Core May 3, 2026
@govert
Copy link
Copy Markdown
Member

govert commented May 12, 2026

How does the LoadFrom(path) interact with the AssemblyLoadContext here? It sounded like the EnterContextualReflection call was better - that ensures the chain of loaded assemblies resolve inside the ALC. Otherwise, they might load into the default ALX, which we don't want. It might be helpful to check the ALCs for the assemblies afterwards to confirm.
If the EnterContextualReflection is the fix, then I'd rather have guidance somewhere saying when it is recommended or needed. Automatically loading failing assemblies by our own probe and LoadFrom seems wrong.

@Sergey-Vlasov
Copy link
Copy Markdown
Contributor Author

Yes, the implemented AppDomain.CurrentDomain.AssemblyResolve solution loads into the default global ALC.

EnterContextualReflection is a solution, if the add-in developer can add the code to invoke it.

Actually, we can use both. The implemented AssemblyResolve makes sure the add-in doesn’t crash by default, and if the add-in requires private ALC then adding a call to EnterContextualReflection per guidance will make it so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WPF control library's resource assembly not found at runtime despite being present in output directory (worked before system reinstall)

2 participants