Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Running .Net Core 3.0 Winforms app targeting x86 in windows 10 #304
I'm trying to run a WinForms App targeting x86 but the application closes immediately and I'm got this error:
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:
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:
Other information that I got from WinDbg is this:
Any idea how to solve this?
-532462766 (0xe0434352). is the code for "some managed exception"
Can you get a managed callstack in windbg? Something like this, from memory
Please let me know if this will help, if not, please let me know the steps to get the info that you need.
@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:
<PropertyGroup> <RuntimeIdentifier>win-x86</RuntimeIdentifier> </PropertyGroup>
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!