【发布时间】:2020-12-26 18:22:23
【问题描述】:
我想为我的 UWP 应用添加一些功能。可选包似乎是一种方法。 所以我把 ViewModel 类和 Page 类移到了可选包中,并把它们放到了可选包的命名空间中。 安装可选包后,我想显示移动的页面,但我总是收到以下错误:
Windows.UI.Xaml.Markup.XamlParseException
HResult=0x802B000A
Message=XAML parsing failed.
Source=System.Private.Interop
StackTrace:
at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32 hr, RuntimeTypeHandle typeHnd) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.Interop\src\Shared\McgMarshal.cs:line 1189
at __Interop.ComCallHelpers.Call(__ComObject __this, RuntimeTypeHandle __typeHnd, Int32 __targetIndex, Void* arg0, Void* arg1, Int32 arg2)
at Windows.UI.Xaml.IApplicationStatics__Impl.Stubs.LoadComponent(__ComObject __this, Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation)
at Windows.UI.Xaml.Application.__Factory_Windows_UI_Xaml__IApplicationStatics_LoadComponent(String typeName, Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation)
at Windows.UI.Xaml.Application.LoadComponent(Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation)
at <my classes>
如何加载和显示可选包的页面?
【问题讨论】:
-
您好,从错误信息来看,问题可能来自您移动的页面的 XAML 部分。你能提供一个最小的复制样本,以便我们分析这个问题吗?
-
您好@RichardZhang-MSFT,感谢您的回答。我将创建一个包含最少项目的解决方案,并在下面的评论中添加一个链接。
-
@RichardZhang-MSFT 我在github.com/pinki/ShowPageOfOptionalPackageErrorSample创建了一个项目
标签: uwp