dotnet / installer

.NET SDK Installer
https://github.com/dotnet/sdk
1.27k stars 446 forks source link

Installer silently terminates Git Extensions #17055

Closed sharwell closed 3 weeks ago

sharwell commented 1 year ago

Steps to reproduce

  1. Launch Git Extensions 4.1.0.16698 and leave it running
  2. Download and install the .NET SDK 8.0 Preview 4 (also reproduces on Preview 6)

Expected behavior

Either of the following:

  1. The installer prompts me to close Git Extensions before proceeding
  2. The installer runs to completion with Git Extensions also running

Actual behavior

Git Extensions is silently terminated during the installation process.

joeloff commented 1 year ago

I double checked and we don't turn of the files-in-use dialog. From the logs though it appears Restart Manager is killing the application. Excerpt below is from the Desktop Runtime installation.

MSI (s) (60:0C) [21:18:29:239]: RESTART MANAGER: Successfully shut down all applications in the service's session that held files in use.
MSI (c) (0C:94) [21:18:29:239]: RESTART MANAGER: Successfully shut down all applications that held files in use.

The default action is always to stop the running application, assuming control went through restart manager and optionally restart it if the application registered itself. However, for applications running under a normal user and the elevated installer, restarting an application won't work (You'll see events from Restart Manager in the Windows Event Viewer).

I have seen the .NET installer trigger files in use. Behavior is different based on whether the application has an active window handle (UI vs. running service, etc.).

We might be able to bypass RM and force the installer service to use the FilesInUse dialog. While the MSI UIs are turned off when running inside a chainer, a handler can be registered to receive these events.

Also, even if we do bypass RM, there are system policies that can be configured that may override disabling RM.

joeloff commented 1 year ago

If I disable Restart Manager by changing the OS policies, I can force the OS to use FilesInUse , and then I see this.

image

joeloff commented 1 year ago

I should also call out that IF you are being patched by an external process (Automatic Updates/WSUS/etc.), the installer will always run quietly and default to stopping applications that are using files.

sharwell commented 1 year ago

I'm hitting this when running the installer manually, e.g. when I open a project and Visual Studio warns that my SDK is too old.

joeloff commented 1 year ago

You then manually download and install a new SDK? Restart Manager is the preferred mechanism starting in Vista, especially for UI based applications.

While it might be possible to try and override RM usage, we would potentially break any application that registered with restart manager. Although it's unlikely those applications can be restarted (it all depends on the SIDs associated with them and the installation process), RM does offer them the change to gracefully shutdown and save data, etc.

With files-in-use, it will simply kill running processes.

joeloff commented 1 year ago

I dug into this a bit further. On Win7 SP1, everything behaves as expected. I created a WPF/WinForms app that registered with Restart Manager. During a full UI based upgrade, the RM/Files in use dialog is shown and I have the option to close/restart or defer closing the application.

On Win 8.1, Win10 (TH1, TH2, RS1 through RS6, 21H1, Server 21H2, W2K8, Win11), Restart Manager shuts the UI based application down without prompting, but still pops up the prompt for non-UI based applications. While it's certainly possible to turn off some of the RM functionality and force the dialog to show, doing so has side-effects that will impact applications that registered with the RM service.

I'm going to try and follow up further on this.

marcpopMSFT commented 3 weeks ago

Old issue triage: Per joeloff, this is really complicated to resolve and there are no plans to address it.