Frame.Navigate crashes when passed a Page-derived class from dynamically-loaded assembly?

30 views Asked by At

The design of my application is such that some assemblies can be dynamically loaded at runtime (unknown at compile time). This is a typical 'plug-in' type architecture where I can discover Page-derived classes in the dynamically loaded assembly via reflection. The design works fine in WPF and WinForms applications where we manage our own windows, frames, and 'navigation'.

With WinUI3, the call to Windows.UI.Xaml.Controls.Frame.Navigate(...) throws an exception when I pass as the first parameter the type of the Page-derived class from the dynamically loaded assembly. The same code works fine if I put this Page-derived class into an assembly that is referenced by the main app exe.

The exception is 6-calls deep in Microsoft.ui.xaml.dll in the stack, and is:

System.ArgumentNullException: 'Value cannot be null. (Parameter 'key')'

Does anyone have any experience with whether this is supposed to work, or if this is a known bug? Or a known (permanent) limitation of the navigate architecture & infrastructure in WinUI3?

0

There are 0 answers