Skip to content

AppInstaller Crashing After Calling Process.Start on MSIX file. #5889

@MattRames

Description

@MattRames

Relevant area(s)

WinGet CLI

Relevant command(s)

winget install

Brief description of your issue

App installer is crashing when our C# application programatically launches a downloaded bundle via Process.Start.

AppInstaller.exe crash from event log

Faulting application name: AppInstaller.exe, version: 1.27.420.0, time stamp: 0x69129eb8
Faulting module name: Microsoft.UI.Xaml.dll, version: 3.1.8.0, time stamp: 0x2239de89
Exception code: 0xc000027b
Fault offset: 0x000000000039dce5
Faulting process id: 0x0xB7DC
Faulting application start time: 0x0x1DC53EA27D98003
Faulting application path: C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.27.420.0_x64__8wekyb3d8bbwe\AppInstaller.exe
Faulting module path: C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.8_8000.642.119.0_x64__8wekyb3d8bbwe\Microsoft.UI.Xaml.dll
Report Id: 0866af73-55a3-4486-8244-fa3379c825b7
Faulting package full name: Microsoft.DesktopAppInstaller_1.27.420.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App

Right now this bug is preventing us from pushing additional app updates out as it'll cause pain for our clients.

Related response: #5847 (comment)

I did confirm with my test app that adding a Thread.Sleep after process start seems to work.

Steps to reproduce

This can be reproduced by creating a basic winexe app and attempting to launch a bundle. Please note Process.Start seems to work for a console application but the bug happens for winexe apps.

Net Framework csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net472</TargetFramework>
    <PlatformTarget>x64</PlatformTarget>
  </PropertyGroup>

</Project>

Program.cs

using System.Diagnostics;

namespace NetFrameworkAppInstallerBug
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var installerPath = ""; // Set path to msix, msixbundle, or appxbundle on your machine
            Process.Start(installerPath);
        }
    }
}

This also happens in a .Net 8 application.

.Net 8 csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
	<PlatformTarget>x64</PlatformTarget>
  </PropertyGroup>

</Project>

Program.cs

using System.Diagnostics;
using System.IO;

namespace AppInstallerBug
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var installerPath = ""; // Set path to msix, msixbundle, or appxbundle on your machine

            var appxBundleName = Path.GetFileName(installerPath);
            var directory = Path.GetDirectoryName(installerPath);

            Process p = new Process();
            p.StartInfo.WorkingDirectory = string.IsNullOrEmpty(directory) ? Path.GetTempPath() : directory;
            p.StartInfo.FileName = appxBundleName;
            p.StartInfo.Verb = "Open";
            p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
            p.StartInfo.UseShellExecute = true;

            p.Start();
        }
    }
}

Expected behavior

AppInstaller shouldn't crash.

Actual behavior

AppInstaller currently crashes after calling process start on a windows app install. (appxbundle, msix, msixbundle etc)

Environment

My Machine Details

Windows Build: 22631.6060

Windows SDK:

Image

(get-appxpackage microwinappruntime*).packagefullname
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Command-InstallIssue related to WinGet InstallIssue-BugIt either shouldn't be doing this or needs an investigation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions