diff --git a/dev/Deployment/DeploymentActivityContext.cpp b/dev/Deployment/DeploymentActivityContext.cpp index 73111979d0..40de107756 100644 --- a/dev/Deployment/DeploymentActivityContext.cpp +++ b/dev/Deployment/DeploymentActivityContext.cpp @@ -5,6 +5,11 @@ #include "DeploymentActivityContext.h" +#include + +// Bug 61543987: [1.8 servicing] Deployment exceptions masked as ERROR_UNHANDLED_EXCEPTION; SetLastFailure logging single chars +#define WINAPPSDK_CHANGEID_61543987 61543987, WinAppSDK_1_8_7 + WindowsAppRuntime::Deployment::Activity::Context& WindowsAppRuntime::Deployment::Activity::Context::Get() { return g_DeploymentActivityContext; @@ -37,7 +42,14 @@ void WindowsAppRuntime::Deployment::Activity::Context::SetLastFailure(const wil: if (failure.pszFile) { - m_lastFailure.file = *failure.pszFile; + if (WinAppSdk::Containment::IsChangeEnabled()) + { + m_lastFailure.file = failure.pszFile; + } + else + { + m_lastFailure.file = *failure.pszFile; + } } else { @@ -48,7 +60,14 @@ void WindowsAppRuntime::Deployment::Activity::Context::SetLastFailure(const wil: if (failure.pszMessage) { - m_lastFailure.message = *failure.pszMessage; + if (WinAppSdk::Containment::IsChangeEnabled()) + { + m_lastFailure.message = failure.pszMessage; + } + else + { + m_lastFailure.message = *failure.pszMessage; + } } else { @@ -57,7 +76,14 @@ void WindowsAppRuntime::Deployment::Activity::Context::SetLastFailure(const wil: if (failure.pszModule) { - m_lastFailure.module = *failure.pszModule; + if (WinAppSdk::Containment::IsChangeEnabled()) + { + m_lastFailure.module = failure.pszModule; + } + else + { + m_lastFailure.module = *failure.pszModule; + } } else { diff --git a/dev/Deployment/DeploymentManager.cpp b/dev/Deployment/DeploymentManager.cpp index f63eea6e16..11ad21001b 100644 --- a/dev/Deployment/DeploymentManager.cpp +++ b/dev/Deployment/DeploymentManager.cpp @@ -18,6 +18,9 @@ // Bug 61124029: [1.8 servicing] Fixing reset activity data on deployment initialization #define WINAPPSDK_CHANGEID_61124029 61124029, WinAppSDK_1_8_6 +// Bug 61543987: [1.8 servicing] Deployment exceptions masked as ERROR_UNHANDLED_EXCEPTION; SetLastFailure logging single chars +#define WINAPPSDK_CHANGEID_61543987 61543987, WinAppSDK_1_8_7 + using namespace winrt; using namespace winrt::Windows::Foundation; @@ -209,9 +212,17 @@ namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implem { deploymentResult = _Initialize(initializeActivityContext, packageFullName, deploymentInitializeOptions, isRepair); } - catch (winrt::hresult_error const& e) + catch (...) { - const HRESULT hr{ e.code() }; + const HRESULT hr = []() -> HRESULT { + if (WinAppSdk::Containment::IsChangeEnabled()) + { + return wil::ResultFromCaughtException(); + } + try { throw; } + catch (winrt::hresult_error const& e) { return e.code(); } + // Non-winrt::hresult_error exceptions propagate (old behavior) + }(); auto packageIdentity{ AppModel::Identity::PackageIdentity::FromPackageFullName(packageFullName.c_str()) }; PCWSTR c_packageNamePrefix{ L"microsoft.windowsappruntime." }; @@ -219,7 +230,7 @@ namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implem std::wstring release; if (CompareStringOrdinal(packageIdentity.Name(), -1, c_packageNamePrefix, -1, TRUE) == CSTR_EQUAL) { - release = packageIdentity.Name() + c_packageNamePrefixLength; + release = packageIdentity.Name() + c_packageNamePrefixLength; } else { @@ -242,7 +253,7 @@ namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implem THROW_HR_MSG(hr, "PackageFullName=%ls Options: ForceDeployment=%c OnErrorShowUI=%c isRepair:%c", packageFullName.c_str(), deploymentInitializeOptions.ForceDeployment() ? 'Y' : 'N', - deploymentInitializeOptions.OnErrorShowUI() ? 'Y' : 'N', isRepair ? 'Y' : 'N' ); + deploymentInitializeOptions.OnErrorShowUI() ? 'Y' : 'N', isRepair ? 'Y' : 'N'); } // Success! diff --git a/dev/RuntimeCompatibilityOptions/RuntimeCompatibilityOptions.idl b/dev/RuntimeCompatibilityOptions/RuntimeCompatibilityOptions.idl index fef275fc8f..048a74db70 100644 --- a/dev/RuntimeCompatibilityOptions/RuntimeCompatibilityOptions.idl +++ b/dev/RuntimeCompatibilityOptions/RuntimeCompatibilityOptions.idl @@ -34,6 +34,9 @@ namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime AppLifecycle_SharedMemoryRedirectionQueueFix = 60972838, SplitMenuFlyoutItem_Available = 60878987, TextIntelligence_Insights = 61106039, + + // 1.8.7 + DeploymentManager_DiagnosabilityFix = 61543987, }; /// Represents a version of the Windows App Runtime. diff --git a/dev/WindowsAppRuntime_BootstrapDLL/MddBootstrapActivity.cpp b/dev/WindowsAppRuntime_BootstrapDLL/MddBootstrapActivity.cpp index 219a015335..8d4faebdab 100644 --- a/dev/WindowsAppRuntime_BootstrapDLL/MddBootstrapActivity.cpp +++ b/dev/WindowsAppRuntime_BootstrapDLL/MddBootstrapActivity.cpp @@ -18,7 +18,7 @@ void WindowsAppRuntime::MddBootstrap::Activity::Context::SetLastFailure(const wi if (failure.pszFile) { - m_lastFailure.file = *failure.pszFile; + m_lastFailure.file = failure.pszFile; } else { @@ -29,7 +29,7 @@ void WindowsAppRuntime::MddBootstrap::Activity::Context::SetLastFailure(const wi if (failure.pszMessage) { - m_lastFailure.message = *failure.pszMessage; + m_lastFailure.message = failure.pszMessage; } else { @@ -38,7 +38,7 @@ void WindowsAppRuntime::MddBootstrap::Activity::Context::SetLastFailure(const wi if (failure.pszModule) { - m_lastFailure.module = *failure.pszModule; + m_lastFailure.module = failure.pszModule; } else { diff --git a/dev/WindowsAppRuntime_BootstrapDLL/MddBootstrapAutoInitializer.cpp b/dev/WindowsAppRuntime_BootstrapDLL/MddBootstrapAutoInitializer.cpp index f2aa32d42a..3077f4add0 100644 --- a/dev/WindowsAppRuntime_BootstrapDLL/MddBootstrapAutoInitializer.cpp +++ b/dev/WindowsAppRuntime_BootstrapDLL/MddBootstrapAutoInitializer.cpp @@ -4,6 +4,7 @@ #include #include #include + #include #include diff --git a/installer/dev/InstallActivityContext.cpp b/installer/dev/InstallActivityContext.cpp index 567098b528..2fb196a181 100644 --- a/installer/dev/InstallActivityContext.cpp +++ b/installer/dev/InstallActivityContext.cpp @@ -4,6 +4,11 @@ #include "pch.h" #include "InstallActivityContext.h" +#include + +// Bug 61543987: [1.8 servicing] Deployment exceptions masked as ERROR_UNHANDLED_EXCEPTION; SetLastFailure logging single chars +#define WINAPPSDK_CHANGEID_61543987 61543987, WinAppSDK_1_8_7 + WindowsAppRuntimeInstaller::InstallActivity::Context& WindowsAppRuntimeInstaller::InstallActivity::Context::Get() { return g_installActivityContext; @@ -37,7 +42,14 @@ void WindowsAppRuntimeInstaller::InstallActivity::Context::SetLastFailure(const if (failure.pszFile) { - m_lastFailure.file = *failure.pszFile; + if (WinAppSdk::Containment::IsChangeEnabled()) + { + m_lastFailure.file = failure.pszFile; + } + else + { + m_lastFailure.file = *failure.pszFile; + } } else { @@ -48,7 +60,14 @@ void WindowsAppRuntimeInstaller::InstallActivity::Context::SetLastFailure(const if (failure.pszMessage) { - m_lastFailure.message = *failure.pszMessage; + if (WinAppSdk::Containment::IsChangeEnabled()) + { + m_lastFailure.message = failure.pszMessage; + } + else + { + m_lastFailure.message = *failure.pszMessage; + } } else {