65.9K
CodeProject is changing. Read more.
Home

Access Violation Crash on Windows Phone Devices

starIconstarIconstarIconstarIconstarIcon

5.00/5 (2 votes)

Apr 22, 2015

CPOL

2 min read

viewsIcon

14081

Access Violation Crash on Windows Phone Devices

Introduction

I’m currently working on a Windows Phone 8.1 app and I noticed that the app crashes when I test it on my Lumia 930. The weird thing was that I was getting no exception, the debug session was stopped when I was navigating in the app. I tried to catch unhandled exception but this also failed. I started looking in the debug output, and I noticed the following line:

The program '[3452] MyApp.WindowsPhone.exe' has exited with code -1073741819 
(0xc0000005) 'Access violation'.

I Googled around a bit and noticed that other people were having the same issue but in other scenarios. For example, some of them had image manipulation as the cause, others had WebViews (myself included, but this wasn’t the issue in my case), or custom controls. I’ll make your Google search easier by enumerating here some of the fixes that I found.

1. Run Visual Studio as Administrator

Some people had this issue while building the project, or even when the app was running. It seems that Visual Studio didn’t have enough rights to access some parts of the memory while debugging. For some people, it worked running it as administrator, but not for me.

2. Remove WebView

Not something you may want to hear about especially if you really need it, but there was/is a bug with the WebView control that was supposed to be fixed in WP 8.1 Update 1. If you need to display a website, you could use the Launcher or you could hope that only a few users will get this crash.

3. Use Dispatcher for Navigation

This helped me fix it. Apparently, due to another bug in WP 8.1, you have to use the Dispatcher when you navigate and you have this crash.

Here are some of the interesting posts I found during my search:

I spent almost one hour searching for some answers, so I hope any of these fixes helped you! Happy coding! :)