Awhile back, I blogged about how Silverlight uses Validation Exceptions, which can cause the debugger to break. I showed how to prevent that from happening, but the solution was less than ideal.
Someone named rlodina commented on the post:
What about manual adding:
in this list.
This comment has been sitting in my inbox for about a week, and I had wanted to follow up on this. Well good gosh, this is easy and it works like a charm. You can in fact tell VS to only ignore ValidationException instances, while still breaking on everything else. Here’s how.
- Click on Debug->Exceptions (Ctrl+D, E for your keyboard folks)
- Click on Add…
- Select the Type as “Common Language Runtime Exceptions”
- Type the name as System.ComponentModel.DataAnnotations.ValidationException and click OK.
- You’ll now see this exception in the list. Uncheck “User-unhandled just for this exception, and click OK.
This lets you keep all of the other exceptions turned on, but Visual Studio will no longer break when Silverlight hits a ValidationException. Like I said, it works like a charm. Thanks rlodina! :-)