question

SpectraCoder avatar image
0 Votes"
SpectraCoder asked TianyuSun-MSFT edited

Can't build in release mode, only debug mode

I've got a weird issue with Visual Studio 2019.
For some reason building my app in Release mode doesn't work. It shortly shows the app's splash screen, and then Visual Studio gives this error:

Unhandled exception at 0x00007FF917E94B89 (KernelBase.dll) in [appname].exe: 0xE0434352 (parameters: 0xFFFFFFFF80070002, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FF904910000).

Followed by this error dialog, if I press the continue button:

An issue in the [appname].exe process caused it to fail to activate. This process threw one or more exceptions.

Use Debug->Windows->Exception Settings to configure the debugger to stop when these exceptions are thrown. More information can be found in the Debug pane of the Output Window (Debug->Windows->Output).


The weird thing is, building in Debug mode works fine, and building and deploying to the Microsoft Store is also without problems.

I've cleaned the obj and bin folders, updated Visual Studio and all used nuget packages, reinstalled Visual Studio... Any clues?

vs-general
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SpectraCoder , welcome to Microsoft Q&A forum. Did you change something before you tested in the Release mode? Did you set some customized configurations or codes which may be affected in the Release mode? Besides, have you checked whether all of the configurations have been set to Release mode(from your project property page > Build tab and the Solution Configuration option of VS)?

1 Vote 1 ·

Hi @TianyuSun-MSFT, thanks for your answer. I took a look at the Build tab in my solution's properties to compare the differences between the Debug configuration and the release configuration.

"Compile with .NET Native tool chain" is unchecked for Debug, and checked for Release. If I uncheck it for Release, it builds fine.

Is it okay to leave it unchecked? It's an UWP app by the way.

0 Votes 0 ·
AddWebSolution-0525 avatar image
0 Votes"
AddWebSolution-0525 answered

From your error I can guess that you're using an external library, either through NuGet or locally.
You have to set up the environment to use this library in both release and debug mode. That means installing it on either one through NuGet or setting up the correct include/library paths in the project settings.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TianyuSun-MSFT avatar image
0 Votes"
TianyuSun-MSFT answered TianyuSun-MSFT edited

Hello @SpectraCoder ,

Thanks for your reply.

“Compile with .NET Native tool chain” is unchecked for Debug, and checked for Release. If I uncheck it for Release, it builds fine.

The “Compile with .NET Native tool chain” option will be checked by default, if you uncheck it, the build will be more like build under “Debug”.

Is it okay to leave it unchecked? It’s an UWP app by the way.

Actually this option/feature is related to UWP app, you provided the key information. Please refer to this document: Getting Started with .NET Native, I think the issue may be caused by one certain lib, or project doesn’t support Release mode and so on, but these are specific environment/project related, so you need to refer to the document and check your project to find out the real cause.

Hope this helps.

Best Regards,
Tianyu


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.