Click here to Skip to main content
15,884,388 members
Articles / Mobile Apps
Tip/Trick

Access Violation Crash on Windows Phone Devices

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
21 Apr 2015CPOL2 min read 13.7K   2   2
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! :)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Feel IT
Romania Romania
Hey! I'm Bogdan Bujdea, a software developer from Romania. I started to learn programming since my first year of highschool with C++. During my time in college I tried various languages like Java, C#, Haskell, Javascript, Python, etc. but my favorite remains C#.
I started my career with Thinslices as a Windows 8 developer, but now I work for Feel IT Services as a Windows Phone developer.

Comments and Discussions

 
SuggestionTips/tricks section, not articles Pin
Alexandru Lungu22-Apr-15 6:07
professionalAlexandru Lungu22-Apr-15 6:07 
GeneralRe: Tips/tricks section, not articles Pin
Bogdan Bujdea22-Apr-15 8:29
Bogdan Bujdea22-Apr-15 8:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.