Mark Ingram
Mark Ingram

Reputation: 73673

Get Visual Studio to throw exceptions across threads

In my Silverlight project I have a thread that fires every x milliseconds. In this thread I was attempting to change the state of the application. This wasn't working and I didn't know why, so put a breakpoint in to the Timer callback. The breakpoint was hit, but the minute I attempted to change the state it just bailed out of the function (assuming an exception has been thrown).

I know why the error occurred - you can't change GUI stuff via a non-GUI thread.

My question is - how can I get Visual Studio to actually break when an exception like that occurs? (Rather than just silently bailing out, which doesn't notify me if there is a problem).

I've tried the "Break when exceptions cross AppDomain or managed / native boundaries", but that didn't have any effect.

Upvotes: 0

Views: 2120

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1502306

Can you change the break handling for InvalidOperationException so it breaks immediately rather than only if it's unhandled?

Upvotes: 4

Related Questions