Skip to content
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

Rich information on Bootstrap initalization failure #2316

Merged
merged 19 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e9fc7df
On error in MddBootstrapIntialize log to EventLog and optionally Debu…
DrusTheAxe Mar 25, 2022
16fff4c
Added ShowUI to C++ auto-initializer.
DrusTheAxe Mar 25, 2022
261c043
Remove hardcoded language tag in URL
DrusTheAxe Mar 25, 2022
aa31e2d
Incorporated feedback
DrusTheAxe Mar 28, 2022
08fddd2
Update C++ AutoInitializer to use MddBootstrapInitialize2 with option…
DrusTheAxe Mar 29, 2022
268aef4
Add MddBootstrapInitializeOptions_OnPackageIdentity_NOP with tests
DrusTheAxe Mar 29, 2022
57ede61
Merge branch 'user/drustheaxe/moar-bootstrap' of https://github.com/m…
DrusTheAxe Mar 29, 2022
38f8471
Moar tests. Fixed NOP/NOOP typo. Added C# support for InitializeOptio…
DrusTheAxe Mar 29, 2022
98eb127
Let's try that. C# AutoInitializer options override
DrusTheAxe Mar 29, 2022
ad1579d
Added build option to control auto-initializer (WindowsAppSDKBootstra…
DrusTheAxe Mar 30, 2022
3dd6707
Minnor reformatting and cleanup
DrusTheAxe Mar 30, 2022
dc1542e
Changed to use TryInitialize and Exit (instead of throwing Initialize…
DrusTheAxe Mar 30, 2022
e6f64ff
Merge branch 'user/drustheaxe/moar-bootstrap' of https://github.com/m…
DrusTheAxe Mar 30, 2022
285e3cd
Incorporated feedbacck
DrusTheAxe Mar 31, 2022
a383b4a
Merge branch 'user/drustheaxe/moar-bootstrap' of https://github.com/m…
DrusTheAxe Mar 31, 2022
53f3eb9
Incorproated feedback. Removed some stale comments
DrusTheAxe Mar 31, 2022
fa7f5f9
Removed unnecessary extra checks for WindowsAppSDKBootstrapInitialize
DrusTheAxe Mar 31, 2022
91804c1
Renamed Microsoft.WindowsAppSDK.MddCommon.targets to Microsoft.Window…
DrusTheAxe Mar 31, 2022
117a462
Updated reference to MddCommon
DrusTheAxe Apr 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions build/NuSpecs/Microsoft.WindowsAppSDK.Bootstrap.CS.targets
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup Condition="'$(WindowsAppSDKBootstrapAutoInitialize)'==''">
<WindowsAppSDKBootstrapAutoInitialize>true</WindowsAppSDKBootstrapAutoInitialize>
<PropertyGroup Condition="'$(WindowsAppSDKBootstrapInitialize)'==''">
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
<WindowsAppSDKBootstrapInitialize>true</WindowsAppSDKBootstrapInitialize>
</PropertyGroup>

<PropertyGroup Condition="'$(WindowsAppSDKBootstrapAutoInitialize)'=='true'">
<PropertyGroup Condition="'$(WindowsAppSDKBootstrapInitialize)'=='true'">
<DefineConstants
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_Default)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_DEFAULT</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_None)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_DEFAULT</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnError_DebugBreak)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONERROR_DEBUGBREAK</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnError_DebugBreak_IfDebuggerAttached)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONERROR_DEBUGBREAK_IFDEBUGGERATTACHED</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnError_FailFast)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONERROR_FAILFAST</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnNoMatch_ShowUI)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONNOMATCH_SHOWUI</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnPackageIdentity_NoOp)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONPACKAGEIDENTITY_NOOP</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_Default)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_DEFAULT</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_None)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_NONE</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnError_DebugBreak)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONERROR_DEBUGBREAK</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnError_DebugBreak_IfDebuggerAttached)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONERROR_DEBUGBREAK_IFDEBUGGERATTACHED</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnError_FailFast)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONERROR_FAILFAST</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnNoMatch_ShowUI)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONNOMATCH_SHOWUI</DefineConstants>
<DefineConstants Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnPackageIdentity_NoOp)'=='true'">$(DefineConstants);MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONPACKAGEIDENTITY_NOOP</DefineConstants>
</PropertyGroup>

<Target Name="GenerateBootstrapCS"
BeforeTargets="BeforeCompile"
Condition="'$(WindowsAppSDKBootstrapAutoInitialize)'=='true'">
Condition="'$(WindowsAppSDKBootstrapInitialize)'=='true'">
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)..\include\MddBootstrapAutoInitializer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\include\WindowsAppSDK-VersionInfo.cs" />
Expand Down
8 changes: 4 additions & 4 deletions build/NuSpecs/WindowsAppSDK-Nuget-Native.Bootstrap.targets
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup Condition="'$(WindowsAppSDKBootstrapAutoInitialize)'==''">
<WindowsAppSDKBootstrapAutoInitialize>true</WindowsAppSDKBootstrapAutoInitialize>
<PropertyGroup Condition="'$(WindowsAppSDKBootstrapInitialize)'==''">
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
<WindowsAppSDKBootstrapInitialize>true</WindowsAppSDKBootstrapInitialize>
</PropertyGroup>

<Target Name="GenerateBootstrapCpp"
BeforeTargets="ClCompile"
Condition="'$(WindowsAppSDKBootstrapAutoInitialize)'=='true'">
Condition="'$(WindowsAppSDKBootstrapInitialize)'=='true'">
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\include\MddBootstrapAutoInitializer.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_Default)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_DEFAULT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_None)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_DEFAULT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_None)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_NONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnError_DebugBreak)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONERROR_DEBUGBREAK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnError_DebugBreak_IfDebuggerAttached)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONERROR_DEBUGBREAK_IFDEBUGGERATTACHED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(WindowsAppSDKBootstrapAutoInitializeOptions_OnError_FailFast)'=='true'">MICROSOFT_WINDOWSAPPSDK_BOOTSTRAP_AUTO_INITIALIZE_OPTIONS_ONERROR_FAILFAST;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down
16 changes: 8 additions & 8 deletions dev/WindowsAppRuntime_BootstrapDLL/MddBootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ HRESULT MddBootstrapInitialize_Log(
UINT32 majorMinorVersion,
PCWSTR versionTag,
PACKAGE_VERSION minVersion) noexcept;
HRESULT MddBootstrapInitialize_ShowUI(
HRESULT MddBootstrapInitialize_ShowUI_OnNoMatch(
UINT32 majorMinorVersion,
PCWSTR versionTag,
PACKAGE_VERSION minVersion);
Expand Down Expand Up @@ -127,10 +127,13 @@ STDAPI MddBootstrapInitialize2(
DebugBreak();
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
}

if (WI_IsFlagSet(options, MddBootstrapInitializeOptions_OnNoMatch_ShowUI) ||
IsOptionEnabled(L"MICROSOFT_WINDOWSAPPRUNTIME_BOOTSTRAP_INITIALIZE_SHOWUI"))
if (hr == HRESULT_FROM_WIN32(ERROR_NO_MATCH))
{
LOG_IF_FAILED(MddBootstrapInitialize_ShowUI(majorMinorVersion, versionTag, minVersion));
if (WI_IsFlagSet(options, MddBootstrapInitializeOptions_OnNoMatch_ShowUI) ||
IsOptionEnabled(L"MICROSOFT_WINDOWSAPPRUNTIME_BOOTSTRAP_INITIALIZE_SHOWUI"))
{
LOG_IF_FAILED(MddBootstrapInitialize_ShowUI_OnNoMatch(majorMinorVersion, versionTag, minVersion));
}
}

if (WI_IsFlagSet(options, MddBootstrapInitializeOptions_OnError_FailFast) ||
Expand Down Expand Up @@ -938,13 +941,11 @@ HRESULT MddBootstrapInitialize_Log(
}
CATCH_RETURN()

HRESULT MddBootstrapInitialize_ShowUI(
HRESULT MddBootstrapInitialize_ShowUI_OnNoMatch(
UINT32 majorMinorVersion,
PCWSTR versionTag,
PACKAGE_VERSION minVersion)
{
//TODO: Show this if ERROR_NO_MATCH vs simpler MessageBox("ERROR 0xN in Bootstrapper initialize", MB_OK) ?

// Get the message caption
PCWSTR caption{};
wil::unique_cotaskmem_string captionString;
Expand Down Expand Up @@ -1008,7 +1009,6 @@ HRESULT MddBootstrapInitialize_ShowUI(
sei.cbSize = sizeof(sei);
sei.lpVerb = L"open";
sei.lpFile = L"https://docs.microsoft.com/windows/apps/windows-app-sdk/downloads";
//TODO:Replace with https://aka.ms/windowsappsdk/<major>.<minor>/latest/windowsappruntimeinstall-<architecture>.exe
sei.nShow = SW_SHOWNORMAL;
LOG_IF_WIN32_BOOL_FALSE(ShellExecuteExW(&sei));
}
Expand Down