-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WinUI3.0 Desktop(App and ClassLibrary)] A UserControl in a ClassLibrary can't be dynamically loaded by a custom AssemblyLoadContext class #3888
Comments
@jevansaks @MikeHillberg any thoughts ? |
The error message in the output is "NamedResource Not found", coming from MRM.dll. That sounds like there's a path to an asset or something that's being requested which can't be resolved by MRT. @SunnyWang1012 look closer at the HelloUserControl.xaml (or share more of the project for us to take a look at) to see where there might be a problem with an ms-appx or ms-resource URI in that file. |
@jevansaks The following screenshots shows the details of HelloUserControl.xaml, it actually doesn't have any content yet. I create that WinUI 3.0 UserControl by "Add New Item" to HelloPlugin project. Do you know if there is any setting I need to do in order to let App load this UserControl correctly? |
@SunnyWang1012 possibly I have addressed similar issue for dotnet/wpf repository. I may be wrong assuming this one is the same, but I had resource not found exception when was trying to load views from different plugins. Issue was closed and the answer was that it should be fixed in the scope of dotnet/wpf but not dotnet/runtime. The issue was found for views shared between multiple plugins. |
Thanks @ValerCheck for your information. In my case, I think the dll assembly loaded successfully except the resource (xaml..etc) stuffs. I try to add HelloPlugin as reference project to App project, then it will be no problem. It seems that when dynamically loading plugins, I miss some "operation" in order to load the related resource as well... |
That makes sense ... but without a repro project we can't help too much. In general assets should get carried through |
@jevansaks |
@MikeHillberg @jevansaks Any thought? |
Some updates...
|
@stevenbrix, could this be an issue that when dynamically loading the DLL we're not finding the user control's XBF? |
@SunnyWang1012 if you disable mixed mode debugging, does this error still persist? I'm wondering if this is the same issue as #3893 |
@alwu for FYI |
@stevenbrix After reading the issue #3893, I try to disable winrt::hresult_error in the exception setting and finally the UI control can be loaded successfully. Thank you so much :) |
Awesome, I'm glad to hear you are unblocked! I'll close this as a dupe of #3893 then :) |
I create several projects and the relations are as following:
In short, I want to use WinUI 3.0 Desktop App to dynamically load a ClassLibrary named HelloPlugin.dll.
[Bug]
I can successfully load HelloPlugin.dll in App and activate as ICommand and some fields leveraging DataProvider.dll are also loaded successfully.
However, when I invoke to get that UserControl field, it crashes at UserControl's constructor show as followings
Can you help to see if I miss anything in order to load resource of UserControl?
The text was updated successfully, but these errors were encountered: