microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

App will be Crash with an InfoBar and Publish as Single File Option

Open ghost1372 opened this issue 3 years ago • 13 comments

Describe the bug

If we have an InfoBar in MainWindow and publish it as a Single File (PublishSingleFile = true) App will not run and will crash.

Steps to reproduce the bug

1.Create a New WinUI 3 Project 2.Change To Unpackaged Project <WindowsPackageType>None</WindowsPackageType> 3. Add InfoBar on MainWindow

<Window
    x:Class="App1.MainWindow">
    <StackPanel>
        <InfoBar
                        Title="Up To Date"
                        IsClosable="False"
                        IsOpen="True"
                        Severity="Success" />
    </StackPanel>
</Window>
  1. Publish Project as Single File (PublishSingleFile = true)
  2. Run Published App

Expected behavior

App should run without any problems

Screenshots

No response

NuGet package version

1.0.0

Packaging type

Unpackaged

Windows version

Windows 11 version 21H2 (22000)

IDE

Visual Studio 2022

Additional context

No response

ghost1372 avatar Apr 04 '22 08:04 ghost1372

Hi @jonwis , @DrusTheAxe Can you track this? Should we report this issue in winui repo?

ghost1372 avatar Apr 17 '22 19:04 ghost1372

@MikeHillberg @BenJKuhn @Scottj1s is a Single File App (PublishSingleFile = true) a problem for WinAppSDK or a N/A and this is a WinUI issue?

If the latter please transfer it to the WinUI repo (oddly enough I can't).

If the former who's on point?

DrusTheAxe avatar Apr 19 '22 00:04 DrusTheAxe

Hi @riverar Can you confirm this issue?

ghost1372 avatar May 24 '22 20:05 ghost1372

Can confirm @ghost1372. Appears to be a WinUI issue but I don't blame you for posting it here since that repository is more/less dead. Maybe @gabbybilka or @marb2000 can help route.

Related: microsoft/microsoft-ui-xaml#6400, microsoft/microsoft-ui-xaml#7063, microsoft/microsoft-ui-xaml#6757, etc.

Best guidance for you right now is to completely avoid using Single File publishing for all WinUI/WinAppSDK work.

riverar avatar May 24 '22 21:05 riverar

Thanks @riverar, and @ghost1372 I will transfer this to the WinUI3 repository so the automated system clone it in our internal Azure DevOps and we can triage and prioritize it.

marb2000 avatar May 25 '22 05:05 marb2000

This crashes for you just running from VS (Control+F5)? I put your markup in a new app, set <PublishSingleFile>true</PublishSingleFile> in the project file, and can't repro the crash.

MikeHillberg avatar Jun 14 '22 19:06 MikeHillberg

Hi @MikeHillberg , When running through VS I have no problem and Everything works well. I attached a sample, Please publish the project with the following settings

<Project>
  <PropertyGroup>
    <PublishProtocol>FileSystem</PublishProtocol>
    <Platform>x86</Platform>
    <RuntimeIdentifier>win10-x86</RuntimeIdentifier>
    <PublishDir>bin\\\win10-x86\publish\</PublishDir>
    <SelfContained>true</SelfContained>
    <PublishSingleFile>true</PublishSingleFile>
    <PublishReadyToRun>true</PublishReadyToRun>
    <Configuration>Release</Configuration>
    <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
    <PublishTrimmed>false</PublishTrimmed>
  </PropertyGroup>
</Project>

Please note that there is an InfoBar in MainWindow

App9.zip

1

Animation

If we execute the published file through Visual Studio (Debug mode), we will get error Animation2

ghost1372 avatar Jun 15 '22 05:06 ghost1372

@MikeHillberg Crash Dump: https://github.com/ghost1372/ReproBugs/releases/download/v1.0.0/Dump.zip

ghost1372 avatar Jun 16 '22 07:06 ghost1372

Thank you @ghost1372!

@DrusTheAxe?

00 Microsoft_WindowsAppRuntime_Bootstrap!MddBootstrap_StopActivity 01 Microsoft_WindowsAppRuntime_Bootstrap!wilResultLoggingThreadCallback 02 Microsoft_WindowsAppRuntime_Bootstrap!wil::details::ThreadFailureCallbackFn<bool (__stdcall&)(wil::FailureInfo const &) noexcept>::NotifyFailure 03 Microsoft_WindowsAppRuntime_Bootstrap!wil::details::ThreadFailureCallbackHolder::GetContextAndNotifyFailure 04 Microsoft_WindowsAppRuntime_Bootstrap!wil::details::GetContextAndNotifyFailure 05 Microsoft_WindowsAppRuntime_Bootstrap!wil::details::LogFailure 06 Microsoft_WindowsAppRuntime_Bootstrap!wil::details::ReportFailure_NoReturn<0> 07 Microsoft_WindowsAppRuntime_Bootstrap!wil::details::ReportFailure_Base<0,0> 08 Microsoft_WindowsAppRuntime_Bootstrap!wil::details::ReportFailure_Msg<0> 09 Microsoft_WindowsAppRuntime_Bootstrap!wil::details::ReportFailure_HrMsg<0> 0a Microsoft_WindowsAppRuntime_Bootstrap!wil::details::in1diag3::_Throw_HrMsg 0b Microsoft_WindowsAppRuntime_Bootstrap!wil::details::in1diag3::Throw_HrIfMsg 0c Microsoft_WindowsAppRuntime_Bootstrap!FindDDLMViaEnumeration 0d Microsoft_WindowsAppRuntime_Bootstrap!CreateLifetimeManagerViaEnumeration 0e Microsoft_WindowsAppRuntime_Bootstrap!CreateLifetimeManager 0f Microsoft_WindowsAppRuntime_Bootstrap!FirstTimeInitialization 10 Microsoft_WindowsAppRuntime_Bootstrap!_MddBootstrapInitialize 11 Microsoft_WindowsAppRuntime_Bootstrap!MddBootstrapInitialize2

MikeHillberg avatar Jun 17 '22 03:06 MikeHillberg

Please run the following command and share the results:

powershell -c "$(get-appxpackage *micro*win*apprun*).packagefullname"

The description and callstack sounds like WindowsAppSDK issue #2592 -- if the Bootstrap API doesn't find a qualifying package it reports the issue before returning but that has a bug which causes a crash. This is fixed in main for vNext and queued up for servicing review for our next update (1.1.2).

That Powershell command will list what WinAppSDK MSIX packages are registered for the user. If the runtime isn't installed1 it will cause this crash in the Bootstrap API. If that's your issue as a workaround you can run the WinAppSDK installer and see if the problem repros.

1 Or is incompletely installed e.g. if Microsoft.WindowsAppRuntime.1.1 is registered for the user but MicrosoftCorporationII.WinAppRuntime.Main.1.1 is not.

DrusTheAxe avatar Jun 17 '22 03:06 DrusTheAxe

Thank you @DrusTheAxe this is my runtimes image

ghost1372 avatar Jun 17 '22 06:06 ghost1372

Hi, @DrusTheAxe @MikeHillberg

I tested with version 1.1.2, It seems that the Bootstrapp issue has been fixed but now i get another exception

Exception thrown at 0x00007FFC5FCBFA7C (KernelBase.dll) in App24.exe: 0xE0434352 (parameters: 0xFFFFFFFF80004003, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FF7EA720000).
Exception thrown at 0x00007FFC5FCBFA7C (KernelBase.dll) in App24.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131534, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FF7EA720000).
Exception thrown at 0x00007FFC5FCBFA7C (KernelBase.dll) in App24.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131534, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FF7EA720000).
Exception thrown at 0x00007FFC5FCBFA7C (KernelBase.dll) in App24.exe: WinRT originate error - 0x80131534 : 'The type initializer for '_IInfoBarFactory' threw an exception.'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFC61E4C2CA: (caller: 00007FFC61E5183F) ReturnHr(1) tid(cd4) 8007007E The specified module could not be found.
Exception thrown at 0x00007FFC5FCBFA7C (KernelBase.dll) in App24.exe: WinRT originate error - 0x802B000A : 'Cannot create instance of type 'Microsoft.UI.Xaml.Controls.InfoBar' [Line: 0 Position: 0]'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFC61E4C2CA: (caller: 00007FFC61E5183F) ReturnHr(2) tid(cd4) 8007007E The specified module could not be found.
Exception thrown at 0x00007FFC5FCBFA7C (KernelBase.dll) in App24.exe: 0xE0434352 (parameters: 0xFFFFFFFF802B000A, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FF7EA720000).
Exception thrown at 0x00007FFC5FCBFA7C (KernelBase.dll) in App24.exe: WinRT originate error - 0x802B000A : 'XAML parsing failed.'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFC61E4C2CA: (caller: 00007FFC61E5183F) ReturnHr(3) tid(cd4) 8007007E The specified module could not be found.
Exception thrown at 0x00007FFC5FCBFA7C (KernelBase.dll) in App24.exe: WinRT originate error - 0x802B000A : 'A failure occurred in Application::OnLaunched, the application is unable to start.'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFC61E4C2CA: (caller: 00007FFC61E5183F) ReturnHr(4) tid(cd4) 8007007E The specified module could not be found.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFC61E4C2CA: (caller: 00007FFC61FACC92) ReturnHr(5) tid(cd4) 8007007E The specified module could not be found.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFC61E4C2CA: (caller: 00007FFC61FAC66E) ReturnHr(6) tid(cd4) 8007007E The specified module could not be found.
Unhandled exception at 0x00007FFBCEC5F33C (Microsoft.ui.xaml.dll) in App24.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x000000002EB0CC90, 0x0000000000000003).

and this is dump from visual studio

https://drive.google.com/file/d/12bejvbCSjrjdJewbc-lAfDh9CMAL5Nrn/view?usp=sharing

image

ghost1372 avatar Jul 06 '22 15:07 ghost1372

Hi @MikeHillberg @DrusTheAxe I tested with v1.1.4 and v1.2-experimental1 None of them work and the app keeps crashing, Please check and fix this problem.

ghost1372 avatar Aug 12 '22 07:08 ghost1372

I'm having the same issue. As soon as a I run the app as "Single File" the app crashed when opening a Window or a Page that has an InfoBar (doesn't matter if that InfoBar is created in C# code or with XAML).

mvsilfho avatar Aug 19 '22 09:08 mvsilfho

any updates on this?

a standard dotnet publish -f net7.0-windows10.0.19041.0 -c Release -p:Platform=x64 with the flag <PublishSingleFile>true</PublishSingleFile> produces a crashing exe even in a blank project.

Logs from Event Viewer

Faulting application name: WinTest.exe, version: 1.0.0.0, time stamp: 0x6377b117
Faulting module name: Microsoft.ui.xaml.dll, version: 3.0.0.2212, time stamp: 0x7dc2efab
Exception code: 0xc000027b
Fault offset: 0x00000000002a2177

nor0x avatar Jan 06 '23 17:01 nor0x

Hi @Scottj1s any news about this issue?

ghost1372 avatar Jun 21 '23 10:06 ghost1372

@ghost1372 No updates - hopefully soon. Thanks for your patience.

Scottj1s avatar Jun 21 '23 15:06 Scottj1s

SDK 1.4 - My apps crash with InfoBar, even when not using the "Single File Option"

HEIC-to-JPEG-Dev avatar Oct 21 '23 11:10 HEIC-to-JPEG-Dev

Today I tested again with the latest version 1.4.2 and got interesting results:

  1. A Blank WinUI 3 app with an InfoBar can be run without any issues! i used this configs:
PublishSingleFile = True
WindowsAppSDKSelfContained = True
PublishReadyToRun = True
SelfContained = True
  1. A Blank WinUI 3 app with an InfoBar can not run and crash app. i used this configs:
IncludeNativeLibrariesForSelfExtract = True
PublishSingleFile = True
WindowsAppSDKSelfContained = True
PublishReadyToRun = True
SelfContained = True

It seems that this bug has been solved partially and the app can be run, but adding IncludeNativeLibrariesForSelfExtract property still causes it to crash. It should also be noted that I have not yet tested it in real and large applications And I just tried on a new and blank project.

ghost1372 avatar Oct 28 '23 09:10 ghost1372

Windows App SDK 1.5 now supports PublishSingleFile: https://www.nuget.org/packages/Microsoft.WindowsAppSDK/1.5.240227000

Scottj1s avatar Feb 29 '24 18:02 Scottj1s