Question

I am developing a WP7 app. The app has a pretty large XML Parsing method and a try/catch block around it. When an exception occurs I just get the causing method's name from the exception's stacktrace, but no line numbers.

So it is pretty annoying to debug in a 400+ LoC method.

My guess is that the pdb files are not deployed to the phone at all.

A workaround would be to split large methods into smaller ones and to use more and smaller try/catch blocks.

But is there any way to enable line numbers in Windows Phone 7 Exceptions?

Was it helpful?

Solution

First of all, a 400+ LoC method is a bad practice, I would definitely recommend to split it.

Little trick: if you're using the debugger, just configure it to break on any exception (in Visual Studio, press Control + Alt + e, and check the 'thrown' checkbox in front of "Common Language Runtime Exceptions". Then, when the exception is thrown, the debugger will automatically stop at the exception location.

Now to answer your question, if you don't have line numbers when compiling in debug mode, then there's probably no practical way to get them. You can try injecting the pdb in the xap file, but I don't think it's worth the trouble.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top