我有一个Windows 10 UWP商店应用程序的问题 .
在应用程序中有两个页面(Page1和Page2)具有类似的xaml控件,但是一个页面(Page1)在通过microsoft测试应用程序时会导致很多问题 . 如果他们尝试启动应用程序,则Page1的初始化会抛出异常 . 当我删除一个特定的xaml控件时,一切都很好,但是Page2包含完全相同的控件并且工作正常 . 在我的本地机器上我没有例外,没有警告,Windows认证套件说应用程序没有问题,我无法重现异常 .
当我从Page1上的CommandBar中删除AppBarButtons时,测试Microsoft测试人员也不例外 . Page2上类似的CommandBar在测试人员的计算机上没有异常 .
Page1的Xaml代码(有问题):
<Page
x:Class="MyApp.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.BottomAppBar>
<CommandBar x:Name="cbCommandBar">
<AppBarButton x:Name="pageBack" Label="Zurück" HorizontalAlignment="Center" VerticalAlignment="Top" Click="pageBack_Click">
<AppBarButton.Icon>
<SymbolIcon Symbol="Previous"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton x:Name="pageNext" Label="Vor" HorizontalAlignment="Center" VerticalAlignment="Top" Click="pageNext_Click">
<AppBarButton.Icon>
<SymbolIcon Symbol="Next"/>
</AppBarButton.Icon>
</AppBarButton>
<CommandBar.SecondaryCommands>
<AppBarButton x:Name="firstPage" Label="Erste Seite" Click="firstPage_Click"/>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
</Page>
第2页的Xaml代码:
<Page
x:Class="MyApp.Page2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.BottomAppBar>
<CommandBar x:Name="cbCommandBar">
<AppBarButton x:Name="downloadImage" Content="Herunterladen" Label="Herunterladen" HorizontalAlignment="Right" VerticalAlignment="Top" Click="downloadImage_Click">
<AppBarButton.Icon>
<SymbolIcon Symbol="Download"/>
</AppBarButton.Icon>
</AppBarButton>
<CommandBar.SecondaryCommands>
<AppBarButton x:Name="viewInBrowser" Label="Webansicht" Click="viewInBrowser_Click"/>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
</Page>
例外:
stowed_exception_802b000a_my_app.dll!windows::ui::xaml::iapplicationstatics__impl::stubclass.loadcomponent
在Windows开发人员中心,我可以看到以下调用堆栈:Frame Bild Funktion Versatz
0 combase.dll RoOriginateErrorW 0x000000000000004E
1 Windows.UI.Xaml.dll DirectUI::ErrorHelper::OriginateError 0x000000000000014C
2 Windows.UI.Xaml.dll CJupiterErrorServiceListener::NotifyErrorAdded 0x0000000000000192
3 Windows.UI.Xaml.dll CErrorService::AddError 0x0000000000000140
4 Windows.UI.Xaml.dll CErrorService::ReportParserError 0x0000000000000126
5 Windows.UI.Xaml.dll ParserErrorService::ReportError 0x0000000000000146
6 Windows.UI.Xaml.dll ParserErrorReporter::SetError 0x000000000000007E
7 Windows.UI.Xaml.dll ObjectWriterErrorService::ReportError 0x0000000000000064
8 Windows.UI.Xaml.dll BinaryFormatObjectWriter::SetValueOnCurrentInstance 0x000000000000087D
9 Windows.UI.Xaml.dll BinaryFormatObjectWriter::WriteNode 0x0000000000000418
10 Windows.UI.Xaml.dll CParser::LoadXamlCore 0x0000000000000536
11 Windows.UI.Xaml.dll CCoreServices::ParseXamlWithExistingFrameworkRoot 0x0000000000000133
12 Windows.UI.Xaml.dll CApplication::LoadComponent 0x000000000000023E
13 Windows.UI.Xaml.dll Application_LoadComponent 0x00000000000000C0
14 Windows.UI.Xaml.dll DirectUI::FrameworkApplication::LoadComponent 0x00000000000000C7
15 Windows.UI.Xaml.dll DirectUI::FrameworkApplicationFactory::LoadComponentWithResourceLocationImpl 0x0000000000000071
16 Windows.UI.Xaml.dll DirectUI::FrameworkApplicationFactory::LoadComponentWithResourceLocation 0x000000000000004D
17 MyApp.McgInterop.dll McgInterop::ComCallHelpers.ComCall__HRESULT 0x000000000000008D
18 MyApp.McgInterop.dll Windows::UI::Xaml::IApplicationStatics__Impl::StubClass.LoadComponent 0x0000000000000074
19 MyApp.exe MyApp::Page1.InitializeComponent 0x000000000000005E
20 MyApp.exe MyApp::Page1..ctor 0x00000000000000AC
21 MyApp.exe MyApp::App..ctor 0x0000000000000083
22 MyApp.exe MyApp::Program::__c._Main_b__0_0 0x0000000000000019
23 MyApp.McgInterop.dll Windows::UI::Xaml::WindowSizeChangedEventHandler.Invoke 0x000000000000000F
24 MyApp.McgInterop.dll McgInterop::ReverseComSharedStubs.Proc_TArg0___System.__Canon_ 0x000000000000005A
25 MyApp.McgInterop.dll Windows::UI::Xaml::ApplicationInitializationCallback__Impl::Vtbl.Invoke__STUB 0x0000000000000037
26 Windows.UI.Xaml.dll DirectUI::FrameworkApplication::MainASTAInitialize 0x00000000000000A7
27 Windows.UI.Xaml.dll DirectUI::FrameworkView::Initialize 0x0000000000000069
28 twinapi.appcore.dll Windows::ApplicationModel::Core::CoreApplicationView::CreateAndInitializeFrameworkView 0x00000000000000A7
29 twinapi.appcore.dll _lambda_84f6292064cee6c4c814a3a064a63b95_::operator 0x00000000000001B4
30 twinapi.appcore.dll _lambda_fe571ab0da94534d32388f0f07e67faa_::operator 0x0000000000000044
31 SHCore.dll _WrapperThreadProc 0x00000000000000C4
32 kernel32.dll BaseThreadInitThunk 0x0000000000000014
33 ntdll.dll RtlUserThreadStart 0x0000000000000021
我找不到解决这个问题的解释 .
也许有人有想法 . 谢谢!
1 回答
我已经测试了page1和page2的XAML代码,它对我来说很好 .
你能为我提供第1页背后的代码吗?
您正在为此项目使用的sdk版本 .
谢谢 .