maui: The program has exited with code 3221226356 (0xc0000374).
Description
Today installed .NET 9 framework and upgraded Visual Studio to the latest version 17.12.0.
Created a “.NET MAUI Blazor Hybrid App” named “AnotherCompany.Apps.SupportMonitor” (and identical solution name), choose “.NET 9.0” framework and choose to include the sample pages.
In the .csproj file, I changed the ApplicationId value to “com.anothercompany.ringmon” as it is otherwise longer than 35 chars which leads to another known issue.
When running the app (in the default “Windows Machine”), in about 50% of the cases the app stops immediately with the following error: The program ‘[18156] AnotherCompany.Apps.SupportMonitor.exe’ has exited with code 3221226356 (0xc0000374).
In the other 50% of the cases, the app starts normally.
This error code seems to indicate there is a heap corruption issue.
Following the same steps on the same machine, but with a project named “MauiApp1”, still changing the ApplicationId to “com.anothercompany.ringmon” does not show this issue.
Environment:
Processor Intel® Core™ Ultra 7 165H 1.40 GHz Installed RAM 32,0 GB (31,5 GB usable) System type 64-bit operating system, x64-based processor Pen and touch No pen or touch input is available for this display
Edition Windows 11 Pro Version 24H2 Installed on 08/10/2024 OS build 26100.2314 Experience Windows Feature Experience Pack 1000.26100.32.0
I’ve made a video exhibiting this issue: https://www.dropbox.com/scl/fi/mfr61w9duyj6xhnp3p2rd/NetMauiFailsWithExitCode3221226356.mp4?rlkey=3uc6xy7fa4yk8xp21awiosiu2&dl=0
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
9.0.0 GA
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
No response
Affected platforms
Windows
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 6
- Comments: 41 (8 by maintainers)
Thanks, also canfirmed it’s because of long file path in windows, according to https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell
Modify
Platforms\Windows\app.manifestadding
solved my problem
I updated all packages to:
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" /> <PackageReference Include="CommunityToolkit.Maui" Version="11.0.0" /> <PackageReference Include="Microsoft.Data.Sqlite.Core" Version="9.0.1" /> <PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.10" /> <PackageReference Include="Syncfusion.Maui.Toolkit" Version="1.0.3" />The problem still persisted. For me the solution was to move the whole project to the root to shorten the path as much as possible:C:\maui_projectI’m testing it since Friday and up to now not a single crash with code 0xc0000374 occurred.I updated these Nuget Packages and the error went away:
Microsoft.AspNetCore.Components.WebView.Maui 9.0.14 to 9.0.30 Microsoft.Extensions.Logging.Debug 9.0.0 to 9.0.1 Microsoft.Maui.Controls 9.0.14 to 9.0.30
I haven’t sufficient evidence yet that that solves the problem, but I managed to fix it for a few projects by keeping the project name to whatever I want, but renaming the project folder to something short (keep it for instance below 8 chars, without spaces are special char).
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>@xcaptain - when you do not have already mapped thews2namespace prefix 😃I am running into the same problem. App starts 1/5 times. Sometimes it crashes when going to another page, but when reopened, it seems fine.
Error is: The program ‘[29340] ProgramName.exe’ has exited with code 3221226356 (0xc0000374).
Are there any updates on this issue? I’m still running into this problem
Hi @danroth27 , I just tested with a plain .NET MAUI app and yes, I have the same issue.
@nuno-barreiro correct,
<ProjectDirectory>\Platforms\Windows\app.manifest.Seem to help make WinUI-only crash with
"has exited with code 3221226356 (0xc0000374)."in .NET Maui 9 less frequent but it still happens. I am on Visual Studio version 17.13.2, .NET 9.0.200Same bug seem submitted and closed a few times: https://github.com/search?q=org%3Adotnet+3221226356+(0xc0000374)&type=issues
I also first noticed it when I enabled MSIX package but even disabling this continued to randomly crash Windows only.
I wish I knew about this workaround sooner though… it helped some. I still hope Microsoft can fix this. Thanks.
@mfdevsz, I build blank MAUI .NET 9 application same issue above
After that, I copy souce code release to folder like this
Can not start application: 3/5 (times)
@codetuner I had the same Problem today, only 30% of Runs actually started my .NET9 Maui. I solved it by completely rebuilding my Application from the Visual Studio template and checking on every step if its still working…
@codetuner we’ll keep this one open for now so we can make sure to not lose track of this one
@ct-issues do you see this same exception if you create a new .NET8 app?