Compiling wpf application to x64 fails after instalation


I have written a WPF app for copying files and such. For reasons of merging pdfs I need to make my app x64. The application works fine as long as it is compiled x86. When I compile x64 it works in visual studio but fails after I install it to my or any other computer which uses 64bit windows.

When compiling my app I use "Any CPU" and disable "prefer 32bit".

The installation file is made with Visual Studio Installer.

When I start the installed application nothing happens.

So far I have checked that all referenced dll-s are compiled as "Any CPU".

How do I debug my situation.

Event log says:

Description: The process was terminated due to an unhandled exception.

Exception Info: System.UnauthorizedAccessException

Faulting module name: KERNELBASE.dll, version: 6.1.7601.24231, time stamp: 0x5b6db5dd

Exception code: 0xe0434352

Fault offset: 0x000000000001a06d

Faulting process id: 0xd54

Faulting module path: C:\Windows\system32\KERNELBASE.dll

asked on Stack Overflow Sep 28, 2018 by Andrej B. • edited Sep 28, 2018 by Andrej B.

2 Answers


After Hans Passant pointed me in the right direction I managed to solve my problem.

In my application I forgot to include a try catch statement in App.xaml.cs . After doing so I caught the exception which stated that the access to a certain folder in my application was denied. The mistake I made was trying to create a folder in my installation location (c:\ProgramFiles...), which I later found out is not good practice. For some reason the x86 compiled application manages to see this fault and simply redirects these folders to the virtual store location, and doesn't bother you. But the application compiled as x64 throws an exception.

After finding the flaw I now simply need to make the folders somewhere else presumably in AppData.

answered on Stack Overflow Sep 29, 2018 by Andrej B.

Launch Visual Studio as Administrator

answered on Stack Overflow Sep 28, 2018 by Kianii

User contributions licensed under CC BY-SA 3.0