views:

15

answers:

1

In my project, I have a local dataset (XSD) that I am using as local-temporary tables. I am getting a System.InvalidCastException when trying to access the field in one the tables. I believe this is because I my code is (incorrectly) not setting a field's value in a row before trying to access it.

My problem is that the exception is breaking in the designer file and not in my code. As a result, I'm having difficulting determining which line of my code reading the field value before it has been set. Is there any way to configure Visual Studio to break in my code instead of in the designer created file?

+1  A: 

Once the debugger breaks on the exception, use Debug + Windows + Call stack. Locate your code in the displayed stack frames and double-click it. Keep that window around, it is one of the most useful debugging tools.

Hans Passant