0

Whenever I try to debug my Windows Phone 7 C# app, I get the following message in the Output window:

A first chance exception of type 'System.OverflowException' occurred in mscorlib.dll

A first chance exception of type 'System.OverflowException' occurred in mscorlib.dll

A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Phone.dll

...And then, App.xaml.cs opens up in VS (still in debug mode, where I can't edit anything), and "System.Diagnostics.Debugger.Break();" is highlighted.

Why is this happening, how can I fix it, and how can I prevent it in the future?

JavaAndCSharp
  • 1,507
  • 3
  • 23
  • 47
  • Sounds to me like something in your App.xaml resources section is broken. We are going to need to see some code from App.xaml and App.xaml.cs to srtart with. – Chris Sainty Jul 19 '11 at 03:22
  • Okay, I found out how to fix it... but *why* the cryptic error messages? And *what* is a `System.OverflowException`? – JavaAndCSharp Jul 19 '11 at 03:52
  • 1
    WPF/XAML usually have poor error messages unfortunately. If the answer is generic enough, post it yourself. It is ok to answer your own questions and might help someone else. – Chris Sainty Jul 19 '11 at 04:10
  • Okay, I guess I'll post it-although I feel bad about answering my own question. – JavaAndCSharp Jul 20 '11 at 02:39
  • 1
    From JeffAtwood himself http://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/ – Chris Sainty Jul 20 '11 at 23:18

1 Answers1

3

Why it happened:

I had an image that was used in MainPage.xaml. This image's source's Copy to Output directory property was set to Do not copy, and as a result, the image failed to load and the app crashed.

How to Fix It:

Change the image in question's source's Copy to Output directory property to Copy Always from Do not copy.

How it can be prevented:

Don't fiddle with my image's Copy to Output directory properties.

...and what caused the System.OverflowException:

My low disk space [I think] is what is causing the System.OverflowExceptions, because these continued to pop up in my Output window after I fixed the problem. Read up on System.OverflowExceptions here.

JavaAndCSharp
  • 1,507
  • 3
  • 23
  • 47