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

DeploymentManager auto-initializer #2835

Merged
merged 15 commits into from
Aug 18, 2022
Merged

Conversation

DrusTheAxe
Copy link
Member

@DrusTheAxe DrusTheAxe commented Aug 9, 2022

Add an auto-initializer for DeploymentManager (very similar to the Bootstrapper's auto-initializer).

If DeploymentManager Initialize fails...
...Write to the eventlog

...Optionally

  • DebugBreak
  • DebugBreak if a debugger is attached to the process
  • FailFast
  • MessageBox (modeled after .NET's) asking if you'd like to install the WindowsAppRuntime and if so, ShellExecute(url) to the download page

The optional behavior is triggered by new DeploymentInitializeOptions properties or by environment variables

SET MICROSOFT_WINDOWSAPPRUNTIME_DEPLOYMENTMANAGER_INITIALIZE_DEBUGBREAK=1
SET MICROSOFT_WINDOWSAPPRUNTIME_DEPLOYMENTMANAGER_INITIALIZE_SHOWUI=1
SET MICROSOFT_WINDOWSAPPRUNTIME_DEPLOYMENTMANAGER_INITIALIZE_FAILFAST=1

Testing partial but incomplete as I need a real build (franken-hacking has been too messy to finish E2E testing). The DeploymentManager auto-initializer is inert/unused unless WindowsAppSdkDeploymentManagerInitialize=true and the default to enable that is commented out for now, making this PR functional but inert so I can get a build turned with real packages for further testing.

*.targets updated to provide build-time control.

  • To disable the auto-initializer the auto-initialize set the property WindowsAppSDKDeploymentManagerAutoInitialize=false
  • If the auto-initalizer is enabled you can define properties to control the options passed via DeploymentInitializeOptions to DeploymentManager.Initialize()
    • WindowsAppSDKDeploymentManagerAutoInitializeOptions_Default=true -- use the default options (OnError_ShowUI)
    • WindowsAppSDKDeploymentManagerAutoInitializeOptions_None=true -- use no options (None)
    • WindowsAppSDKDeploymentManagerAutoInitializeOptions_*=true -- enable the option where * is one or more of the following
      • OnError_DebugBreak
      • OnError_DebugBreak_IfDebuggerAttached
      • OnError_FailFast
      • OnError_ShowUI
      • OnNoPackageIdentity_NoOp

For example, to disable the auto-initializer add to your *proj file:

<PropertyGroup>
    <WindowsAppSDKDeploymentManagerAutoInitialize>false</WindowsAppSDKDeploymentManagerAutoInitialize>
</PropertyGroup>

or to enable the auto-initializer (default) but use the DebugBreak+FailFast options (instead of the default)

<PropertyGroup>
    <WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_DebugBreak>true</WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_DebugBreak>
    <WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_ShowUI>true</WindowsAppSDKDeploymentManagerAutoInitializeOptions_OnError_ShowUI>
</PropertyGroup>

https://task.ms/40724739

…nspired by Bootstrapper's auto-initializer. Split test\Deployment into subdirs. Working through build-isms
…ve path notation for package reference goo...
@DrusTheAxe DrusTheAxe added feature area-Deployment Issues related to packaging, installation, runtime (e.g., SelfContained, Unpackaged) labels Aug 9, 2022
@DrusTheAxe DrusTheAxe added this to the 1.2 milestone Aug 9, 2022
@DrusTheAxe DrusTheAxe requested a review from sachintaMSFT August 9, 2022 01:43
@DrusTheAxe DrusTheAxe self-assigned this Aug 9, 2022
@ghost ghost added the needs-triage label Aug 9, 2022
@DrusTheAxe
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@DrusTheAxe
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DrusTheAxe
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DrusTheAxe
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DrusTheAxe
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@DrusTheAxe DrusTheAxe marked this pull request as ready for review August 17, 2022 02:07
@DrusTheAxe
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DrusTheAxe
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DrusTheAxe
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DrusTheAxe
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DrusTheAxe DrusTheAxe requested a review from kythant August 17, 2022 03:27
@DrusTheAxe DrusTheAxe merged commit 344d07b into main Aug 18, 2022
@DrusTheAxe DrusTheAxe deleted the user/drustheaxe/depmgrautoinit branch August 18, 2022 02:14
Copy link
Contributor

@sachintaMSFT sachintaMSFT left a comment

Choose a reason for hiding this comment

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

Minor comments.

const AppModel::Identity::PackageIdentity& packageIdentity,
const std::wstring& release);
}

inline void Initialize_StopSuccessActivity(
Copy link
Contributor

Choose a reason for hiding this comment

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

With these parameter changes, the inline function should be named StopActivity instead of StopSuccessActivity.

THROW_HR(hr);
}

// Success!
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you are not logging success activity here for telemetry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Deployment Issues related to packaging, installation, runtime (e.g., SelfContained, Unpackaged) feature proposal needs-triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants