-
Notifications
You must be signed in to change notification settings - Fork 702
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][Debug] Frame
cann't navigate with the type from reflection from another assembly when not reference the project or assembly directly
#8601
Comments
Reflection
not support custom xaml control
tried some times, I find the reason. The compiler will generate a var appProviderProperty = this.GetType().GetProperty("_AppProvider", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var appProvider = appProviderProperty!.GetValue(this)!;
var appProviderProviderProperty = appProvider.GetType().GetProperty("Provider", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var appProviderProvider = appProviderProviderProperty!.GetValue(appProvider);
var othersProperty = appProviderProvider!.GetType().GetProperty("OtherProviders", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var otherProviders = othersProperty!.GetValue(appProviderProvider) as List<Microsoft.UI.Xaml.Markup.IXamlMetadataProvider>;
var originType = Assembly.Load("MyAssembly").GetType("MyAssembly.MyAssembly_XamlTypeInfo.XamlMetaDataProvider");
var provider = Activator.CreateInstance(originType!) as Microsoft.UI.Xaml.Markup.IXamlMetadataProvider;
otherProviders!.Add(provider!); Is it possible to provide a frendly way to do it in future? |
Reflection
not support custom xaml controlReflection
not support custom xaml control
Reflection
not support custom xaml controlReflection
not support custom xaml control
Reflection
not support custom xaml controlFrame
cann't navigate the type from reflection from another assembky when not reference the project or assembly
Frame
cann't navigate the type from reflection from another assembky when not reference the project or assemblyFrame
cann't navigate with the type from reflection from another assembky when not reference the project or assembly
What's more, i start the app with |
Frame
cann't navigate with the type from reflection from another assembky when not reference the project or assemblyFrame
cann't navigate with the type from reflection from another assembly when not reference the project or assembly directly
Describe the bug
I have a custom class named BasePage (empty class) which inherited the Page class, and another class named MainPage inherited the BasePage, when i create a instance of MainPage by reflection,i got a error: Microsoft.UI.Xaml.Markup.XamlParseException:“XAML parsing failed.”, but if i refer the project which the MainPage in,and reflect it or create it by new,it works.
Steps to reproduce the bug
create a custom page with xaml, then create it's instance by reflection at another project.
NuGet package version
WinUI 3 - Windows App SDK 1.3.2: 1.3.230602002
Windows version
Windows 11 (22H2): Build 22621
The text was updated successfully, but these errors were encountered: