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

WINUI 3 Unable to Run Published App Due To KERNELBASE.dll Crash #6757

Open
1 of 2 tasks
robinwilson16 opened this issue Feb 21, 2022 · 16 comments
Open
1 of 2 tasks

WINUI 3 Unable to Run Published App Due To KERNELBASE.dll Crash #6757

robinwilson16 opened this issue Feb 21, 2022 · 16 comments
Labels
area-Tooling bug Something isn't working Crash whenever user reports a crash or app freeze product-winui3 WinUI 3 issues team-Markup Issue for the Markup team

Comments

@robinwilson16
Copy link

Describe the bug

I cannot get any WINUI desktop apps I create to run outside of Visual Studio however I publish them (single app or lots of files and with or without ClickOnce installation.
I am using the 17.1 version of Visual Studio 2022 on the latest Windows 11 insider build.

Steps to reproduce the bug

Create a new Blank App, Packaged (WINUI 3 in Desktop) and then publish this (for example selecting ClickOnce then the single file option or deploying all files to a share).
Nothing happens when the .exe is launched and looking in Event Viewer Application log the following errors appears:

First this one:

Application: App1.exe
CoreCLR Version: 6.0.222.6406
.NET Version: 6.0.2
Description: The process was terminated due to an unhandled exception.
Exception Info: System.DllNotFoundException: Dll was not found.
   at App1.Program.Main(String[] args)

Then this one:

Faulting application name: App1.exe, version: 1.0.0.0, time stamp: 0x61e1d094
Faulting module name: KERNELBASE.dll, version: 10.0.22557.1, time stamp: 0xab780977
Exception code: 0xe0434352
Fault offset: 0x00145df2
Faulting process ID: 0x0x5B90
Faulting application start time: 0x0x1D82778001B2502
Faulting application path: C:\Users\robin.wilson\AppData\Local\Apps\2.0\6WEQ0LKJ.QKZ\CM4PW9HN.PCX\app1..tion_0000000000000000_0001.0000_8e4f39cd130acc58\App1.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report ID: 253e7f9c-9d74-492f-9f03-89af28e232fc
Faulting package full name: 
Faulting package-relative application ID: 

Expected behavior

The app should launch and display the main window

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.0

Windows app type

  • UWP
  • Win32

Device form factor

No response

Windows version

No response

Additional context

No response

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Feb 21, 2022
@StephenLPeters StephenLPeters added area-Tooling product-winui3 WinUI 3 issues team-Markup Issue for the Markup team labels Mar 5, 2022
@StephenLPeters
Copy link
Contributor

@evelynwu-msft FYI

@BSchafer01
Copy link

Is there any feedback or guidance on this issue? I'm running into the same issue with the MSIX produced for sideloading a winUI 3 application.

@mqudsi
Copy link

mqudsi commented Mar 10, 2022

You probably don't have it set to self-contained.

@robinwilson16
Copy link
Author

Still happens whatever options are picked and just doesn't work

@victariox
Copy link

I have the same problem and real problem is shadowed with Kernelbase.dll problem, any suggestions how to proceed with this ?

@iR3turnZ
Copy link

iR3turnZ commented Jul 15, 2022

I also have the nearly the same problem but if i publish it into a folder it works. If I copy the files from the folder publish to the ClickOnce files i dont get a error that says that "Microsoft.WindowsAppRuntime.Bootstrap.dll" is missing anymore but I get the same KERNELBASE.dll error.
Running WindowsAppSdk 1.1.2, VS 17.2.3 and Windows 19044.1766

@bpulliam bpulliam added the Crash whenever user reports a crash or app freeze label Oct 13, 2022
@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Dec 6, 2022
@applefanbois
Copy link

I have the same problem, when I drag and drop a file on a dropActionHandler it will crash 1 in 10 times.

The dumbest thing ever is that I get a unhandled exception inside a try catch block.

Of course this is typical MS quality here.

@c3rebro
Copy link

c3rebro commented Mar 17, 2023

I maybe have a similar issue in my WINUI3 Win32 (win10 x64 19045) Desktop App under .NET6.

The Application Runs fine when launched in Debug Mode. As a release build or when packed to folder (single file) i got these problems:

Published to Folder as single File: KERNELBASE.DLL Error like mentioned above
Release Build: The App opens, but the Titlebar is "inactive". That means: no response to Max/Min/Close Buttons. Even Not dragable.

The TitleBar-Issue seems to be related to the AppSDk Version:

WinUI 3 - Windows App SDK 1.2.230118.102 = titlebar working
WinUI 3 - Windows App SDK 1.2.230313.1 = titlebar not working

To reproduce the issue i had to clean the project (remove obj and bin folders in windows fileexplorer)

Downgrading to 1.2.230118.102 fixed the titlebar issue. However, i still get the kernelbase error when packed to a single file.

@JoeTomkinson
Copy link

JoeTomkinson commented Mar 30, 2023

I have this same exception; I have managed to isolate it to when I submit a message within the UI which in the background saves data to a file at the directory returned from:

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

Exception thrown at 0x00007FFA1681FE7C (KernelBase.dll) in appnamespace.exe: 0xE0434352 (parameters: 0xFFFFFFFF80070005, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FF8E1C60000).
onecore\com\combase\registrationstore\registrationstoredata.cpp(1055)\combase.dll!00007FFA175588B9: (caller: 00007FFA1754E1E5) ReturnHr(436) tid(2c80c) 80070002 The system cannot find the file specified.
onecore\com\combase\registrationstore\registrationstoredata.cpp(1055)\combase.dll!00007FFA175588B9: (caller: 00007FFA1754E1E5) ReturnHr(437) tid(2c80c) 80070002 The system cannot find the file specified.
Exception thrown at 0x00007FFA1681FE7C (KernelBase.dll) in appnamespace.exe: 0xE0434352 (parameters: 0xFFFFFFFF80070005, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FF8E1C60000).
Exception thrown at 0x00007FFA1681FE7C (KernelBase.dll) in appnamespace.exe: WinRT originate error - 0x80070005 : 'Access to the path 'C:\Program Files\WindowsApps\PUBLISHERINFO.329567E69597C_1.0.11.0_x64__1wwrtwbj9qrjm\bpe' is denied.'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFA174EC07A: (caller: 00007FFA174F15EF) ReturnHr(438) tid(2c80c) 8007007E The specified module could not be found.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFA174EC07A: (caller: 00007FFA1768CF82) ReturnHr(439) tid(2c80c) 8007007E The specified module could not be found.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFA174EC07A: (caller: 00007FFA1768C95E) ReturnHr(440) tid(2c80c) 8007007E The specified module could not be found.
Unhandled exception at 0x00007FF9C9DED8BC (Microsoft.ui.xaml.dll) in appnamespace.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0000023B74998140, 0x0000000000000003).

Warning: Unable to load Dynamic Function Table Callback DLL 'C:\Program Files\WindowsApps\PUBLISHERINFO.329567E69597C_1.0.11.0_x64__1wwrtwbj9qrjm\mscordaccore.dll'. Call stacks may be truncated. Access is denied.

The Exception Message is:

Unhandled exception at 0x00007FF9C9DED8BC (Microsoft.ui.xaml.dll) in appnamespace.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0000023B74998140, 0x0000000000000003).

I thought maybe it was an elevation issue, but that doesn't seem to be the case. This works in Debug and Release for x32 and x64. Not sure if anyone has any suggestions as to where to look.

@benaclejames
Copy link

+1 to this, even seems to happen on a fresh VM. Very strange

@JoeTomkinson
Copy link

I have this same exception; I have managed to isolate it to when I submit a message within the UI which in the background saves data to a file at the directory returned from:

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

Exception thrown at 0x00007FFA1681FE7C (KernelBase.dll) in appnamespace.exe: 0xE0434352 (parameters: 0xFFFFFFFF80070005, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FF8E1C60000).
onecore\com\combase\registrationstore\registrationstoredata.cpp(1055)\combase.dll!00007FFA175588B9: (caller: 00007FFA1754E1E5) ReturnHr(436) tid(2c80c) 80070002 The system cannot find the file specified.
onecore\com\combase\registrationstore\registrationstoredata.cpp(1055)\combase.dll!00007FFA175588B9: (caller: 00007FFA1754E1E5) ReturnHr(437) tid(2c80c) 80070002 The system cannot find the file specified.
Exception thrown at 0x00007FFA1681FE7C (KernelBase.dll) in appnamespace.exe: 0xE0434352 (parameters: 0xFFFFFFFF80070005, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FF8E1C60000).
Exception thrown at 0x00007FFA1681FE7C (KernelBase.dll) in appnamespace.exe: WinRT originate error - 0x80070005 : 'Access to the path 'C:\Program Files\WindowsApps\PUBLISHERINFO.329567E69597C_1.0.11.0_x64__1wwrtwbj9qrjm\bpe' is denied.'.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFA174EC07A: (caller: 00007FFA174F15EF) ReturnHr(438) tid(2c80c) 8007007E The specified module could not be found.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFA174EC07A: (caller: 00007FFA1768CF82) ReturnHr(439) tid(2c80c) 8007007E The specified module could not be found.
onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFA174EC07A: (caller: 00007FFA1768C95E) ReturnHr(440) tid(2c80c) 8007007E The specified module could not be found.
Unhandled exception at 0x00007FF9C9DED8BC (Microsoft.ui.xaml.dll) in appnamespace.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0000023B74998140, 0x0000000000000003).

Warning: Unable to load Dynamic Function Table Callback DLL 'C:\Program Files\WindowsApps\PUBLISHERINFO.329567E69597C_1.0.11.0_x64__1wwrtwbj9qrjm\mscordaccore.dll'. Call stacks may be truncated. Access is denied.

The Exception Message is:

Unhandled exception at 0x00007FF9C9DED8BC (Microsoft.ui.xaml.dll) in appnamespace.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0000023B74998140, 0x0000000000000003).

I thought maybe it was an elevation issue, but that doesn't seem to be the case. This works in Debug and Release for x32 and x64. Not sure if anyone has any suggestions as to where to look.

I narrowed my issue down to a 3rd party NuGet package with a literal directory path trying to write data to somewhere it wasn't allowed to once it was installed within the WindowsApps directory once it's installed from the store or sideloaded.

You'd think there would be a more meaningful exception being raised natively for this.

@hugocvx
Copy link

hugocvx commented Aug 8, 2023

Same for me on two fresh install today.
Sample app run in debug with visual, but not outside of visual or with publishing process.

@robinwilson16
Copy link
Author

I had to switch to WFP to get my app to work last time and re-do parts of it.
Before I start my next app and find it won't publish either, has this issue/bug been fixed and will WINUI apps publish without crashing as I notice a year and a half later it is still open and others reporting the same issue and no fix or workaround as far as I can tell.

@applefanbois
Copy link

Stay away from this stinker.

@duncanmacmichael duncanmacmichael added the bug Something isn't working label Oct 31, 2023
@IsmailHassani
Copy link

Maybe a little bit late, but i noticed that this issue is still open.
So here it goes.

Check if you're code make use a foreach loop. If the foreach loops through a null valued list, your application will crash.
The strange thing is that most of the time the application just crashes as you mentioned. But in very rare case (1 out of the 25 times) it manages to stick to the debugger and show the actual error.

So instead of using:

foreach (var item in list)
{
}

which potential could be null, use an extension method

foreach (var item in list.EnsureNotNull())
{
}

The extension method can be simple as source

    /// <summary>
    /// Ensures enumerable is not null
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="list">The list.</param>
    /// <returns>IEnumerable&lt;T&gt;.</returns>
    public static IEnumerable<T> EnsureNotNull<T>(this IEnumerable<T> list)
    {
        return list ?? Enumerable.Empty<T>();
    }

@arihannu
Copy link

arihannu commented Feb 6, 2025

Something that I found out since I have also a lot of problems with packaging:

I have 2 projects, one is the Application, second is a Package project.

When Application project has the following set:
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>

-> it installed fine, but it will not launch.

However, seems that with:
<WindowsAppSDKSelfContained>false</WindowsAppSDKSelfContained>

-> it installed fine, and does launch and run just fine.

One twist to the plot:
If I have just one project (Application) that has packaging configured inside it (single-project packaging), the application will run fine not matter if <WindowsAppSDKSelfContained> is true or false.

There is just one caveat: When built with <WindowsAppSDKSelfContained>false</WindowsAppSDKSelfContained> I cannot run the application outside of the appcontainer, i.e. I cannot debug it in Visual Studio nor run it. Only by first installing it and launching it from the Start menu shortcut it will run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Tooling bug Something isn't working Crash whenever user reports a crash or app freeze product-winui3 WinUI 3 issues team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests