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

DeploymentInitializeOptions spec update #2885

Merged
merged 2 commits into from
Sep 9, 2022
Merged
Changes from 1 commit
Commits
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
67 changes: 66 additions & 1 deletion specs/Deployment/DeploymentAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,57 @@ they shut down, to refer to the updated framework package.
}
```

#### OnError_*

Additional behavior is available if an error occurs in `DeploymentManager.Initialize()`,
per the following logic:

```c++
DeploymentManager::Initialize(...)
{
HRESULT hr = S_OK

// Only supported in packaged processes
if IsPackagedProcess()
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
{
// Do the initialization work
hr = _Initialize(...)
}
else
{
// We're not a packaged process. Is calling Initialize an error or ignore it?
if options.OnNoPackageIdentity_NOOP
return OK
else
hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)
}
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
if FAILED(hr)
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
{
LogToEventLog(hr, ...)

// Should we pop the debugger?
if options.OnError_DebugBreak or (options.OnError_DebugBreak_IfDebuggerAttached and IsDebuggerPresent())
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
DebugBreak()

// Should we pop some UI?
if options.OnError_ShowUI
MessageBox(...)

// Should we FailFast?
if options.OnError_FailFast
FAIL_FAST_HR_MSG(hr, ...)
}

return OK
}
```

# API Details

```C# (but really MIDL3)
namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime
{
[contractversion(2)]
[contractversion(3)]
apicontract DeploymentContract{};

/// Represents the current Deployment status of the WindowsAppRuntime
Expand Down Expand Up @@ -221,6 +266,26 @@ namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime
/// WindowsAppSDK main and singleton packages will be shut down forcibly if they are
/// currently in use, when registering the WinAppSDK packages.
Boolean ForceDeployment;

/// If not successful call DebugBreak()
[contract(DeploymentContract, 3)]
Boolean OnError_DebugBreak;
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved

/// If not successful call DebugBreak() if a debugger is attached to the process
[contract(DeploymentContract, 3)]
Boolean OnError_DebugBreak_IfDebuggerAttached;

/// If not successful perform a fail-fast
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
[contract(DeploymentContract, 3)]
Boolean OnError_FailFast;

/// If not successful show UI
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
[contract(DeploymentContract, 3)]
Boolean OnError_ShowUI;

/// Do nothing (do not error) if the process lacks package identity
[contract(DeploymentContract, 3)]
Boolean OnNoPackageIdentity_NOOP;
DrusTheAxe marked this conversation as resolved.
Show resolved Hide resolved
};

/// Used to query deployment information for WindowsAppRuntime
Expand Down