Running .Net Core 3.0 Winforms app targeting x86 in windows 10
See original GitHub issueI’m trying to run a WinForms App targeting x86 but the application closes immediately and I’m got this error:
'WindowsFormsAppCore3.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.0.0-preview-27122-01\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[316] WindowsFormsAppCore3.exe: Program Trace' has exited with code 0 (0x0).
The program '[316] WindowsFormsAppCore3.exe' has exited with code -532462766 (0xe0434352).
How to replicate it:
First open File Explorer and create a folder to host your project. Then open a command prompt of your choice, move to the folder you have just created and then execute the following command:
dotnet new winforms
Open visual Studio 2019 Preview, Create a Blank Solution, then add the recently created project to the solution, then right click on the project -> properties -> Build -> Platform terget: x86 and then run it.
In the event viewer I got this:
Faulting application name: WindowsFormsAppCore3.exe, version: 1.0.0.0, time stamp: 0x5bf60478
Faulting module name: KERNELBASE.dll, version: 10.0.17134.441, time stamp: 0x428de48c
Exception code: 0xe0434352
Fault offset: 0x000000000003a388
Faulting process id: 0x1b7c
Faulting application start time: 0x01d4a761408d779b
Faulting application path: C:\XXXX\poc\WindowsFormsAppCore3\bin\Debug\netcoreapp3.0\WindowsFormsAppCore3.exe
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report Id: 20ffea93-24b8-4e77-bdbb-94b05dd2e04c
Faulting package full name:
Faulting package-relative application ID:
Other information that I got from WinDbg is this:
Microsoft (R) Windows Debugger Version 10.0.18303.1000 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.
CommandLine: C:\XXX\poc\WindowsFormsAppCore3\bin\Debug\netcoreapp3.0\WindowsFormsAppCore3.exe
************* Path validation summary **************
Response Time (ms) Location
Deferred srv*
Symbol search path is: srv*
Executable search path is:
ModLoad: 00007ff6`59e50000 00007ff6`59ea7000 apphost.exe
ModLoad: 00007ffd`6d2a0000 00007ffd`6d481000 ntdll.dll
ModLoad: 00007ffd`6c760000 00007ffd`6c812000 C:\Windows\System32\KERNEL32.DLL
ModLoad: 00007ffd`69ad0000 00007ffd`69d43000 C:\Windows\System32\KERNELBASE.dll
ModLoad: 00007ffd`69880000 00007ffd`6997a000 C:\Windows\System32\ucrtbase.dll
(2924.4920): Break instruction exception - code 80000003 (first chance)
ntdll!LdrpDoDebuggerBreak+0x30:
00007ffd`6d36c93c cc int 3
0:000> .sympath srv*
Symbol search path is: srv*
Expanded Symbol search path is: cache*;SRV*https://msdl.microsoft.com/download/symbols
************* Path validation summary **************
Response Time (ms) Location
Deferred srv*
0:000> .reload
Reloading current modules
.....
0:000> g
ModLoad: 00007ffd`16a20000 00007ffd`16ab4000 C:\Program Files\dotnet\host\fxr\3.0.0-preview-27122-01\hostfxr.dll
ModLoad: 00007ffd`16980000 00007ffd`16a16000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.0.0-preview-27122-01\hostpolicy.dll
ModLoad: 00007ffd`020d0000 00007ffd`0268b000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.0.0-preview-27122-01\coreclr.dll
ModLoad: 00007ffd`6d0e0000 00007ffd`6d181000 C:\Windows\System32\ADVAPI32.dll
ModLoad: 00007ffd`6a880000 00007ffd`6a91e000 C:\Windows\System32\msvcrt.dll
ModLoad: 00007ffd`6a820000 00007ffd`6a87b000 C:\Windows\System32\sechost.dll
ModLoad: 00007ffd`6c020000 00007ffd`6c144000 C:\Windows\System32\RPCRT4.dll
ModLoad: 00007ffd`6aa80000 00007ffd`6abd1000 C:\Windows\System32\ole32.dll
ModLoad: 00007ffd`6c2a0000 00007ffd`6c5c2000 C:\Windows\System32\combase.dll
ModLoad: 00007ffd`69d50000 00007ffd`69dca000 C:\Windows\System32\bcryptPrimitives.dll
ModLoad: 00007ffd`6a920000 00007ffd`6a948000 C:\Windows\System32\GDI32.dll
ModLoad: 00007ffd`69dd0000 00007ffd`69f62000 C:\Windows\System32\gdi32full.dll
ModLoad: 00007ffd`69980000 00007ffd`69a1f000 C:\Windows\System32\msvcp_win.dll
ModLoad: 00007ffd`6c5d0000 00007ffd`6c760000 C:\Windows\System32\USER32.dll
ModLoad: 00007ffd`69860000 00007ffd`69880000 C:\Windows\System32\win32u.dll
ModLoad: 00007ffd`6c150000 00007ffd`6c212000 C:\Windows\System32\OLEAUT32.dll
ModLoad: 00007ffd`6d210000 00007ffd`6d261000 C:\Windows\System32\SHLWAPI.dll
ModLoad: 00007ffd`56ac0000 00007ffd`56aca000 C:\Windows\SYSTEM32\VERSION.dll
ModLoad: 00007ffd`690b0000 00007ffd`690d5000 C:\Windows\SYSTEM32\bcrypt.dll
ModLoad: 00007ffd`6d010000 00007ffd`6d03d000 C:\Windows\System32\IMM32.DLL
(2924.4920): Unknown exception - code 04242420 (first chance)
ModLoad: 00007ffc`e09e0000 00007ffc`e11b8000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.0.0-preview-27122-01\System.Private.CoreLib.dll
ModLoad: 00007ffd`08070000 00007ffd`081c4000 C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.0.0-preview-27122-01\clrjit.dll
ModLoad: 00007ffd`69630000 00007ffd`69641000 C:\Windows\System32\kernel.appcore.dll
ModLoad: 00000208`05840000 00000208`05848000 C:\XXX\poc\WindowsFormsAppCore3\bin\Debug\netcoreapp3.0\WindowsFormsAppCore3.dll
ModLoad: 00000208`05840000 00000208`05848000 WindowsFormsAppCore3.exe
(2924.4920): C++ EH exception - code e06d7363 (first chance)
(2924.4920): C++ EH exception - code e06d7363 (first chance)
(2924.4920): C++ EH exception - code e06d7363 (first chance)
(2924.4920): C++ EH exception - code e06d7363 (first chance)
(2924.4920): C++ EH exception - code e06d7363 (first chance)
(2924.4920): CLR exception - code e0434352 (first chance)
(2924.4920): CLR exception - code e0434352 (!!! second chance !!!)
KERNELBASE!RaiseException+0x68:
00007ffd`69b0a388 488b8c24c0000000 mov rcx,qword ptr [rsp+0C0h] ss:0000006d`a9badde0=0000402aa92ca8eb
Any idea how to solve this?
Thank you
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Started to get "This project is targeting a version of .NET ...
I'm getting this same issue with ASP.Net Core 3.1. The solution has been fine for two years and now it want's to install...
Read more >Install .NET on Windows
In this article, you'll learn how to install .NET on Windows. .NET is made up of the runtime and the SDK. The runtime...
Read more >What's new in .NET Core 3.0
This article describes what is new in .NET Core 3.0. One of the biggest enhancements is support for Windows desktop applications (Windows only)....
Read more >NET application publishing overview
Applications you create with .NET can be published in two different modes, and the mode affects how a user runs your app.
Read more >NETSDK1045: The current .NET SDK does not support ...
NET SDK version. Open the project file (.csproj, .vbproj, or .fsproj) and check the target framework. This is the version of the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@pveliz What’s probably happening here is that only the managed DLL is compiled as x86. The rest (CoreCLR, launcher EXE, etc.) is compiled as x64. As we all know, we cannot mix-and-match two architectures in the same process, and the exception message is stating this (albeit in a rather unclear manner). Hence, changing the architecture in the Properties dialog is the wrong way to build a 32-bit application. The correct way (AFAIK) is to add the following code to your csproj:
Then restore and rebuild the project. Note that doing this may cause VS/.NET CLI to download x86 versions of the entire .NET Core runtime, which may take a while. Hope this helps!
It looks like the WinForms portion of this issue was addressed with @wjk’s suggestion. If you need a framework dependent app and it’s not working for you, please file an issue in dotnet/cli