microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.16k stars 1.13k forks source link

Install via .msixupload/.msix result in KERNELBASE.dll crashes on launch #13401

Open warrenronsiek opened 1 month ago

warrenronsiek commented 1 month ago

Problem Description

I have a RNW 0.74.8 app that I cant get through the Microsoft app store. Testers report that the application is crashing on launch with KERNELBASE.dll exception:

Application Error:
Faulting application name: ChronoKeep.exe, version: 1.0.0.0, time stamp: 0x666b74f2
Faulting module name: KERNELBASE.dll, version: 10.0.22000.2538, time stamp: 0x06aca232
Exception code: 0xe0434352
Fault offset: 0x0000000000052bdc
Faulting process id: 0x199c
Faulting application start time: 0x01dac0fa3707e67b
Faulting application path: C:\Program Files\WindowsApps\WarrenRonsiek.ChronoKeep_0.1.17.0_x64__fyfmssxvw1b2a\ChronoKeep.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: 2696ba12-1e57-4111-a5b0-9d0b3dca6476
Faulting package full name: WarrenRonsiek.ChronoKeep_0.1.17.0_x64__fyfmssxvw1b2a
Faulting package-relative application ID: App

The app runs fine when installed via the install scripts in the generated sideloading _Test dir. However, when you try to install from the .misx file contained in the .misxupload bundle, the app will crash on launch with the above exception. I've replicated the issue in a public repo below and in several 4 different windows 10/11 environments.

Possibly related to https://github.com/microsoft/react-native-windows/issues/4749

Steps To Reproduce

  1. Create a generic react-native-windows C# project from init scripts
  2. Use VStudio to generate a signing certificate and update the PackageCertificateKeyFile, PackageCertificateThumbprint to match your generated key. Also double-click install the certificate - you will need to direct the installer to place the certificate into the "Trusted Root Certificate" type/folder. (Important! If you don't do this, you cant install via .msixupload contents later.)
  3. Build the project in VStudio such that you get a .misxupload (also, npx react-native run-windows --release --no-deploy --no-launch --logging)
  4. Rename-Item -Path "MyApp_x64.msixupload" -NewName "MyApp.zip"
  5. Expand-Archive -Path MyApp.zip -DestinationPath MyApp
  6. Double-click install the MyApp\MyApp.misx package

You can also install/run the .misxupload bundle included in the demo git repo: https://github.com/warrenronsiek/RNW11Bug/tree/master/windows/RNW11Bug/AppPackages/

Expected Results

App launches normally.

CLI version

12.3.2

Environment

System:
  OS: Windows 10 10.0.20348
  CPU: (4) x64 Intel(R) Xeon(R) CPU @ 2.80GHz
  Memory: 12.52 GB / 16.00 GB
Binaries:
  Node:
    version: 20.11.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 3.6.4
    path: C:\Program Files\nodejs\yarn.CMD
  npm:
    version: 10.8.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    AllowAllTrustedApps: Enabled
    Versions:
      - 10.0.18362.0
      - 10.0.19041.0
      - 10.0.20348.0
      - 10.0.22000.0
      - 10.0.22621.0
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.9.34728.123 (Visual Studio Community 2022)
Languages:
  Java:
    version: 21.0.2
    path: /c/Program Files/OpenJDK/jdk-21.0.2/bin/javac
  Ruby:
    version: 3.3.0
    path: C:\tools\ruby33\bin\ruby.EXE
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.2
    wanted: 0.74.2
  react-native-windows:
    installed: 0.74.8
    wanted: 0.74.8
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Community Modules

No response

Target Platform Version

10.0.19041

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Release

Snack, code example, screenshot, or link to a repository

https://github.com/warrenronsiek/RNW11Bug

chrisglein commented 1 month ago

Thank you so much for taking the time to narrow this down and produce a standalone repro repo.

Have you got this in a debugger to get the actual exception info, callstack, and all that? If it's a store installed app, you should be able to launch that either from Visual Studio or from WinDbg by selecting debug installed app package. That way you get the normal launch behavior and not the behavior of launching from the built app project (where you are saying this doesn't repro).

warrenronsiek commented 1 month ago

.NET debug output is unfortunately unilluminating. I get an sequence of error popups saying "process started... but activation request failed with error 'Target process aborted before activation could be completed... the app didn't start.'"

'RNW11Bug.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. 
'RNW11Bug.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Program Files\WindowsApps\WarrenRonsiek.140127852D945_1.0.2.0_x64__fyfmssxvw1b2a\RNW11Bug.exe'. 
'RNW11Bug.exe' (CLR v4.0.30319: Immersive Application Domain): Loaded 'C:\Program Files\WindowsApps\WarrenRonsiek.140127852D945_1.0.2.0_x64__fyfmssxvw1b2a\System.Runtime.DLL'. 
'RNW11Bug.exe' (CLR v4.0.30319: Immersive Application Domain): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.WindowsRuntime.dll'. 
'RNW11Bug.exe' (CLR v4.0.30319: Immersive Application Domain): Loaded 'C:\Program Files\WindowsApps\WarrenRonsiek.140127852D945_1.0.2.0_x64__fyfmssxvw1b2a\\WinMetadata\Windows.winmd'. Module was built without symbols.
'RNW11Bug.exe' (CLR v4.0.30319: Immersive Application Domain): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll'. Module was built without symbols.
'RNW11Bug.exe' (CLR v4.0.30319: Immersive Application Domain): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.InteropServices.WindowsRuntime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.WindowsRuntime.dll'. Module was built without symbols.
The program '[23964] RNW11Bug.exe' has exited with code 3762504530 (0xe0434352).

With a Native debugger I get:

'RNW11Bug.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\WarrenRonsiek.140127852D945_1.0.2.0_x64__fyfmssxvw1b2a\RNW11Bug.exe'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\mscoree.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. 
The thread 26112 has exited with code 0 (0x0).
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1_clr0400.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_clr0400.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase_clr0400.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\Windows.ApplicationModel.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\twinapi.appcore.dll'. 
'RNW11Bug.exe' (Win32): Unloaded 'C:\Windows\System32\twinapi.appcore.dll'
'RNW11Bug.exe' (Win32): Unloaded 'C:\Windows\System32\SHCore.dll'
'RNW11Bug.exe' (Win32): Unloaded 'C:\Windows\System32\Windows.ApplicationModel.dll'
Exception thrown at 0x00007FFA8775BA99 (KernelBase.dll) in RNW11Bug.exe: 0x04242420 (parameters: 0x0000000031415927, 0x00007FFA73B00000, 0x0000006CBCDFEC80).
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\psapi.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\5983164f9d7f1ca6cc256f34d228e951\mscorlib.ni.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\WarrenRonsiek.140127852D945_1.0.2.0_x64__fyfmssxvw1b2a\System.Runtime.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\WarrenRonsiek.140127852D945_1.0.2.0_x64__fyfmssxvw1b2a\System.Runtime.dll'. 
'RNW11Bug.exe' (Win32): Unloaded 'C:\Program Files\WindowsApps\WarrenRonsiek.140127852D945_1.0.2.0_x64__fyfmssxvw1b2a\System.Runtime.dll'
Exception thrown at 0x00007FFA8775BA99 in RNW11Bug.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000006CBCDFC8A0.
Exception thrown at 0x00007FFA8775BA99 in RNW11Bug.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Exception thrown at 0x00007FFA8775BA99 in RNW11Bug.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000006CBCDFC8A0.
Exception thrown at 0x00007FFA8775BA99 in RNW11Bug.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Exception thrown at 0x00007FFA8775BA99 in RNW11Bug.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000006CBCDFC8A0.
Exception thrown at 0x00007FFA8775BA99 in RNW11Bug.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Exception thrown at 0x00007FFA8775BA99 in RNW11Bug.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000006CBCDFC8A0.
Exception thrown at 0x00007FFA8775BA99 in RNW11Bug.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
Exception thrown at 0x00007FFA8775BA99 in RNW11Bug.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x0000006CBCDFC8A0.
Exception thrown at 0x00007FFA8775BA99 (KernelBase.dll) in RNW11Bug.exe: 0xE0434352 (parameters: 0xFFFFFFFF80070002, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFA73B00000).
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.WindowsRuntime.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.WindowsRuntime.dll'. 
'RNW11Bug.exe' (Win32): Unloaded 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.WindowsRuntime.dll'
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\cryptsp.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\rsaenh.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clrjit.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\WarrenRonsiek.140127852D945_1.0.2.0_x64__fyfmssxvw1b2a\WinMetadata\Windows.winmd'. Module was built without symbols.
'RNW11Bug.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\WarrenRonsiek.140127852D945_1.0.2.0_x64__fyfmssxvw1b2a\WinMetadata\Windows.winmd'. Module was built without symbols.
'RNW11Bug.exe' (Win32): Unloaded 'C:\Program Files\WindowsApps\WarrenRonsiek.140127852D945_1.0.2.0_x64__fyfmssxvw1b2a\WinMetadata\Windows.winmd'
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll'. Module was built without symbols.
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll'. Module was built without symbols.
'RNW11Bug.exe' (Win32): Unloaded 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll'
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.InteropServices.WindowsRuntime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.WindowsRuntime.dll'. Module was built without symbols.
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.InteropServices.WindowsRuntime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.WindowsRuntime.dll'. Module was built without symbols.
'RNW11Bug.exe' (Win32): Unloaded 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.InteropServices.WindowsRuntime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.WindowsRuntime.dll'
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\MrmCoreR.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\Windows.StateRepositoryClient.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\Windows.StateRepositoryCore.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\profapi.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\Windows.UI.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\WindowManagementAPI.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\TextInputFramework.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\InputHost.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\twinapi.appcore.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\CoreUIComponents.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\propsys.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\ntmarta.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\BCP47mrm.dll'. 
'RNW11Bug.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. 
Unhandled exception at 0x00007FFA8775BA99 (KernelBase.dll) in RNW11Bug.exe: 0xE0434352 (parameters: 0xFFFFFFFF80070002, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFA73B00000).

Native debugger callstack is:

>   KernelBase.dll!00007ffa8775ba99()   Unknown
    clr.dll!00007ffa73c28584()  Unknown
    clr.dll!00007ffa73f08e5a()  Unknown
    clr.dll!00007ffa73ec62e3()  Unknown
    mscoreei.dll!00007ffa74cb6f6a() Unknown
    mscoreei.dll!00007ffa74cad658() Unknown
    mscoree.dll!00007ffa74d4ac42()  Unknown
    kernel32.dll!00007ffa88e27344() Unknown
    ntdll.dll!00007ffa89f3cc91()    Unknown