Skip to content
Merged
32 changes: 29 additions & 3 deletions dev/Deployment/DeploymentActivityContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

#include "DeploymentActivityContext.h"

#include <FrameworkUdk/Containment.h>

// 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;
Expand Down Expand Up @@ -37,7 +42,14 @@ void WindowsAppRuntime::Deployment::Activity::Context::SetLastFailure(const wil:

if (failure.pszFile)
{
m_lastFailure.file = *failure.pszFile;
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_61543987>())
{
m_lastFailure.file = failure.pszFile;
}
else
{
m_lastFailure.file = *failure.pszFile;
}
}
else
{
Expand All @@ -48,7 +60,14 @@ void WindowsAppRuntime::Deployment::Activity::Context::SetLastFailure(const wil:

if (failure.pszMessage)
{
m_lastFailure.message = *failure.pszMessage;
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_61543987>())
{
m_lastFailure.message = failure.pszMessage;
}
else
{
m_lastFailure.message = *failure.pszMessage;
}
}
else
{
Expand All @@ -57,7 +76,14 @@ void WindowsAppRuntime::Deployment::Activity::Context::SetLastFailure(const wil:

if (failure.pszModule)
{
m_lastFailure.module = *failure.pszModule;
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_61543987>())
{
m_lastFailure.module = failure.pszModule;
}
else
{
m_lastFailure.module = *failure.pszModule;
}
}
else
{
Expand Down
19 changes: 15 additions & 4 deletions dev/Deployment/DeploymentManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -209,17 +212,25 @@ 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<WINAPPSDK_CHANGEID_61543987>())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is trickier to separate out with containment, but I'm ok with this technique

{
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." };
const size_t c_packageNamePrefixLength{ ARRAYSIZE(L"microsoft.windowsappruntime.") - 1 };
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
{
Expand All @@ -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!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions dev/WindowsAppRuntime_BootstrapDLL/MddBootstrapActivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Windows.h>
#include <stdint.h>
#include <stdlib.h>

#include <MddBootstrap.h>
#include <WindowsAppSDK-VersionInfo.h>

Expand Down
23 changes: 21 additions & 2 deletions installer/dev/InstallActivityContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include "pch.h"
#include "InstallActivityContext.h"

#include <FrameworkUdk/Containment.h>

// 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;
Expand Down Expand Up @@ -37,7 +42,14 @@ void WindowsAppRuntimeInstaller::InstallActivity::Context::SetLastFailure(const

if (failure.pszFile)
{
m_lastFailure.file = *failure.pszFile;
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_61543987>())
{
m_lastFailure.file = failure.pszFile;
}
else
{
m_lastFailure.file = *failure.pszFile;
}
}
else
{
Expand All @@ -48,7 +60,14 @@ void WindowsAppRuntimeInstaller::InstallActivity::Context::SetLastFailure(const

if (failure.pszMessage)
{
m_lastFailure.message = *failure.pszMessage;
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_61543987>())
{
m_lastFailure.message = failure.pszMessage;
}
else
{
m_lastFailure.message = *failure.pszMessage;
}
}
else
{
Expand Down