Skip to content

Commit 375c483

Browse files
committed
repro
1 parent 18e4128 commit 375c483

27 files changed

+807
-0
lines changed

BlankApp1/App.cpp

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#include "pch.h"
2+
3+
#include "App.h"
4+
#include "MainPage.h"
5+
6+
using namespace winrt;
7+
using namespace Windows::ApplicationModel;
8+
using namespace Windows::ApplicationModel::Activation;
9+
using namespace Windows::Foundation;
10+
using namespace Windows::UI::Xaml;
11+
using namespace Windows::UI::Xaml::Controls;
12+
using namespace Windows::UI::Xaml::Navigation;
13+
using namespace BlankApp1;
14+
using namespace BlankApp1::implementation;
15+
16+
/// <summary>
17+
/// Initializes the singleton application object. This is the first line of authored code
18+
/// executed, and as such is the logical equivalent of main() or WinMain().
19+
/// </summary>
20+
App::App()
21+
{
22+
InitializeComponent();
23+
Suspending({ this, &App::OnSuspending });
24+
25+
#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
26+
UnhandledException([this](IInspectable const&, UnhandledExceptionEventArgs const& e)
27+
{
28+
if (IsDebuggerPresent())
29+
{
30+
auto errorMessage = e.Message();
31+
__debugbreak();
32+
}
33+
});
34+
#endif
35+
}
36+
37+
/// <summary>
38+
/// Invoked when the application is launched normally by the end user. Other entry points
39+
/// will be used such as when the application is launched to open a specific file.
40+
/// </summary>
41+
/// <param name="e">Details about the launch request and process.</param>
42+
void App::OnLaunched(LaunchActivatedEventArgs const& e)
43+
{
44+
Frame rootFrame{ nullptr };
45+
auto content = Window::Current().Content();
46+
if (content)
47+
{
48+
rootFrame = content.try_as<Frame>();
49+
}
50+
51+
// Do not repeat app initialization when the Window already has content,
52+
// just ensure that the window is active
53+
if (rootFrame == nullptr)
54+
{
55+
// Create a Frame to act as the navigation context and associate it with
56+
// a SuspensionManager key
57+
rootFrame = Frame();
58+
59+
rootFrame.NavigationFailed({ this, &App::OnNavigationFailed });
60+
61+
if (e.PreviousExecutionState() == ApplicationExecutionState::Terminated)
62+
{
63+
// Restore the saved session state only when appropriate, scheduling the
64+
// final launch steps after the restore is complete
65+
}
66+
67+
if (e.PrelaunchActivated() == false)
68+
{
69+
if (rootFrame.Content() == nullptr)
70+
{
71+
// When the navigation stack isn't restored navigate to the first page,
72+
// configuring the new page by passing required information as a navigation
73+
// parameter
74+
rootFrame.Navigate(xaml_typename<BlankApp1::MainPage>(), box_value(e.Arguments()));
75+
}
76+
// Place the frame in the current Window
77+
Window::Current().Content(rootFrame);
78+
// Ensure the current window is active
79+
Window::Current().Activate();
80+
}
81+
}
82+
else
83+
{
84+
if (e.PrelaunchActivated() == false)
85+
{
86+
if (rootFrame.Content() == nullptr)
87+
{
88+
// When the navigation stack isn't restored navigate to the first page,
89+
// configuring the new page by passing required information as a navigation
90+
// parameter
91+
rootFrame.Navigate(xaml_typename<BlankApp1::MainPage>(), box_value(e.Arguments()));
92+
}
93+
// Ensure the current window is active
94+
Window::Current().Activate();
95+
}
96+
}
97+
}
98+
99+
/// <summary>
100+
/// Invoked when application execution is being suspended. Application state is saved
101+
/// without knowing whether the application will be terminated or resumed with the contents
102+
/// of memory still intact.
103+
/// </summary>
104+
/// <param name="sender">The source of the suspend request.</param>
105+
/// <param name="e">Details about the suspend request.</param>
106+
void App::OnSuspending([[maybe_unused]] IInspectable const& sender, [[maybe_unused]] SuspendingEventArgs const& e)
107+
{
108+
// Save application state and stop any background activity
109+
}
110+
111+
/// <summary>
112+
/// Invoked when Navigation to a certain page fails
113+
/// </summary>
114+
/// <param name="sender">The Frame which failed navigation</param>
115+
/// <param name="e">Details about the navigation failure</param>
116+
void App::OnNavigationFailed(IInspectable const&, NavigationFailedEventArgs const& e)
117+
{
118+
throw hresult_error(E_FAIL, hstring(L"Failed to load Page ") + e.SourcePageType().Name);
119+
}

BlankApp1/App.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#pragma once
2+
#include "App.xaml.g.h"
3+
4+
namespace winrt::BlankApp1::implementation
5+
{
6+
struct App : AppT<App>
7+
{
8+
App();
9+
10+
void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const&);
11+
void OnSuspending(IInspectable const&, Windows::ApplicationModel::SuspendingEventArgs const&);
12+
void OnNavigationFailed(IInspectable const&, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const&);
13+
};
14+
}

BlankApp1/App.idl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace BlankApp1
2+
{
3+
}

BlankApp1/App.xaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Application
2+
x:Class="BlankApp1.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:BlankApp1">
6+
7+
</Application>
1.4 KB
Loading
7.52 KB
Loading
2.87 KB
Loading
1.61 KB
Loading
Loading

BlankApp1/Assets/StoreLogo.png

1.42 KB
Loading
3.13 KB
Loading

BlankApp1/BlankApp1.vcxproj

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\..\WinRTComponent\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\WinRTComponent\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props')" />
4+
<PropertyGroup Label="Globals">
5+
<CppWinRTOptimized>true</CppWinRTOptimized>
6+
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
7+
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
8+
<MinimalCoreWin>true</MinimalCoreWin>
9+
<ProjectGuid>{2849b168-edb9-4cac-ab6f-70ce2453551c}</ProjectGuid>
10+
<ProjectName>BlankApp1</ProjectName>
11+
<RootNamespace>BlankApp1</RootNamespace>
12+
<DefaultLanguage>en-US</DefaultLanguage>
13+
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
14+
<AppContainerApplication>true</AppContainerApplication>
15+
<ApplicationType>Windows Store</ApplicationType>
16+
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
17+
<WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
18+
<WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
19+
</PropertyGroup>
20+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
21+
<ItemGroup Label="ProjectConfigurations">
22+
<ProjectConfiguration Include="Debug|ARM">
23+
<Configuration>Debug</Configuration>
24+
<Platform>ARM</Platform>
25+
</ProjectConfiguration>
26+
<ProjectConfiguration Include="Debug|Win32">
27+
<Configuration>Debug</Configuration>
28+
<Platform>Win32</Platform>
29+
</ProjectConfiguration>
30+
<ProjectConfiguration Include="Debug|x64">
31+
<Configuration>Debug</Configuration>
32+
<Platform>x64</Platform>
33+
</ProjectConfiguration>
34+
<ProjectConfiguration Include="Release|ARM">
35+
<Configuration>Release</Configuration>
36+
<Platform>ARM</Platform>
37+
</ProjectConfiguration>
38+
<ProjectConfiguration Include="Release|Win32">
39+
<Configuration>Release</Configuration>
40+
<Platform>Win32</Platform>
41+
</ProjectConfiguration>
42+
<ProjectConfiguration Include="Release|x64">
43+
<Configuration>Release</Configuration>
44+
<Platform>x64</Platform>
45+
</ProjectConfiguration>
46+
</ItemGroup>
47+
<PropertyGroup Label="Configuration">
48+
<ConfigurationType>Application</ConfigurationType>
49+
<PlatformToolset>v140</PlatformToolset>
50+
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
51+
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
52+
<CharacterSet>Unicode</CharacterSet>
53+
</PropertyGroup>
54+
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
55+
<UseDebugLibraries>true</UseDebugLibraries>
56+
<LinkIncremental>true</LinkIncremental>
57+
</PropertyGroup>
58+
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
59+
<UseDebugLibraries>false</UseDebugLibraries>
60+
<WholeProgramOptimization>true</WholeProgramOptimization>
61+
<LinkIncremental>false</LinkIncremental>
62+
</PropertyGroup>
63+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
64+
<ImportGroup Label="ExtensionSettings">
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets">
70+
<Import Project="PropertySheet.props" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<ItemDefinitionGroup>
74+
<ClCompile>
75+
<PrecompiledHeader>Use</PrecompiledHeader>
76+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
77+
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
78+
<WarningLevel>Level4</WarningLevel>
79+
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
80+
<!--Temporarily disable cppwinrt heap enforcement to work around xaml compiler generated std::shared_ptr use -->
81+
<AdditionalOptions Condition="'$(CppWinRTHeapEnforcement)'==''">/DWINRT_NO_MAKE_DETECTION %(AdditionalOptions)</AdditionalOptions>
82+
<DisableSpecificWarnings>
83+
</DisableSpecificWarnings>
84+
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
85+
</ClCompile>
86+
<Link>
87+
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
88+
</Link>
89+
</ItemDefinitionGroup>
90+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
91+
<ClCompile>
92+
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
93+
</ClCompile>
94+
</ItemDefinitionGroup>
95+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
96+
<ClCompile>
97+
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
98+
</ClCompile>
99+
<Link>
100+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
101+
<OptimizeReferences>true</OptimizeReferences>
102+
</Link>
103+
</ItemDefinitionGroup>
104+
<ItemGroup>
105+
<ClInclude Include="pch.h" />
106+
<ClInclude Include="App.h">
107+
<DependentUpon>App.xaml</DependentUpon>
108+
</ClInclude>
109+
<ClInclude Include="MainPage.h">
110+
<DependentUpon>MainPage.xaml</DependentUpon>
111+
</ClInclude>
112+
</ItemGroup>
113+
<ItemGroup>
114+
<ApplicationDefinition Include="App.xaml">
115+
<SubType>Designer</SubType>
116+
</ApplicationDefinition>
117+
<Page Include="MainPage.xaml">
118+
<SubType>Designer</SubType>
119+
</Page>
120+
</ItemGroup>
121+
<ItemGroup>
122+
<AppxManifest Include="Package.appxmanifest">
123+
<SubType>Designer</SubType>
124+
</AppxManifest>
125+
</ItemGroup>
126+
<ItemGroup>
127+
<Image Include="Assets\LockScreenLogo.scale-200.png" />
128+
<Image Include="Assets\SplashScreen.scale-200.png" />
129+
<Image Include="Assets\Square150x150Logo.scale-200.png" />
130+
<Image Include="Assets\Square44x44Logo.scale-200.png" />
131+
<Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
132+
<Image Include="Assets\StoreLogo.png" />
133+
<Image Include="Assets\Wide310x150Logo.scale-200.png" />
134+
</ItemGroup>
135+
<ItemGroup>
136+
<ClCompile Include="pch.cpp">
137+
<PrecompiledHeader>Create</PrecompiledHeader>
138+
</ClCompile>
139+
<ClCompile Include="App.cpp">
140+
<DependentUpon>App.xaml</DependentUpon>
141+
</ClCompile>
142+
<ClCompile Include="MainPage.cpp">
143+
<DependentUpon>MainPage.xaml</DependentUpon>
144+
</ClCompile>
145+
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
146+
</ItemGroup>
147+
<ItemGroup>
148+
<Midl Include="App.idl">
149+
<DependentUpon>App.xaml</DependentUpon>
150+
</Midl>
151+
<Midl Include="MainPage.idl">
152+
<DependentUpon>MainPage.xaml</DependentUpon>
153+
</Midl>
154+
</ItemGroup>
155+
<ItemGroup>
156+
<None Include="packages.config" />
157+
<None Include="PropertySheet.props" />
158+
<Text Include="readme.txt">
159+
<DeploymentContent>false</DeploymentContent>
160+
</Text>
161+
</ItemGroup>
162+
<ItemGroup>
163+
<ProjectReference Include="..\..\WinRTComponent\RuntimeComponent1.csproj">
164+
<Project>{ccc02cae-23fa-4746-b1ab-180e4b3c754d}</Project>
165+
</ProjectReference>
166+
</ItemGroup>
167+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
168+
<ImportGroup Label="ExtensionTargets">
169+
<Import Project="..\..\WinRTComponent\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\WinRTComponent\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
170+
</ImportGroup>
171+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
172+
<PropertyGroup>
173+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
174+
</PropertyGroup>
175+
<Error Condition="!Exists('..\..\WinRTComponent\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\WinRTComponent\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
176+
<Error Condition="!Exists('..\..\WinRTComponent\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\WinRTComponent\packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
177+
</Target>
178+
</Project>

BlankApp1/BlankApp1.vcxproj.filters

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<ApplicationDefinition Include="App.xaml" />
5+
</ItemGroup>
6+
<ItemGroup>
7+
<Page Include="MainPage.xaml" />
8+
</ItemGroup>
9+
<ItemGroup>
10+
<Midl Include="App.idl" />
11+
<Midl Include="MainPage.idl" />
12+
</ItemGroup>
13+
<ItemGroup>
14+
<ClCompile Include="pch.cpp" />
15+
<ClCompile Include="App.cpp" />
16+
<ClCompile Include="MainPage.cpp" />
17+
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
18+
</ItemGroup>
19+
<ItemGroup>
20+
<ClInclude Include="pch.h" />
21+
</ItemGroup>
22+
<ItemGroup>
23+
<Image Include="Assets\Wide310x150Logo.scale-200.png">
24+
<Filter>Assets</Filter>
25+
</Image>
26+
<Image Include="Assets\StoreLogo.png">
27+
<Filter>Assets</Filter>
28+
</Image>
29+
<Image Include="Assets\Square150x150Logo.scale-200.png">
30+
<Filter>Assets</Filter>
31+
</Image>
32+
<Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png">
33+
<Filter>Assets</Filter>
34+
</Image>
35+
<Image Include="Assets\Square44x44Logo.scale-200.png">
36+
<Filter>Assets</Filter>
37+
</Image>
38+
<Image Include="Assets\SplashScreen.scale-200.png">
39+
<Filter>Assets</Filter>
40+
</Image>
41+
<Image Include="Assets\LockScreenLogo.scale-200.png">
42+
<Filter>Assets</Filter>
43+
</Image>
44+
</ItemGroup>
45+
<ItemGroup>
46+
<AppxManifest Include="Package.appxmanifest" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<Filter Include="Assets">
50+
<UniqueIdentifier>{e48dc53e-40b1-40cb-970a-f89935452892}</UniqueIdentifier>
51+
</Filter>
52+
</ItemGroup>
53+
<ItemGroup>
54+
<None Include="PropertySheet.props" />
55+
<None Include="packages.config" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<Text Include="readme.txt" />
59+
</ItemGroup>
60+
</Project>

0 commit comments

Comments
 (0)