Saturday, May 26, 2007

Suppress “A first chance exception of type…” Messages in VS 2005

When writing an API framework, it's good practice to throw appropriate framework exceptions. I have several extended application exceptions in my rule engine framework. When executing all unit tests, or just stepping through the development code, I would see hundred of messages in Visual Studio of 'A first chance exception of type' ...
This is just perfect behavior from my development point of view. I'm throwing these exceptions myself from the framework. I've made several attempts to find how to disable these messages. And finally I found the answer on Peter Macej blog:

How To Disable “A first chance exception of type…” Messages in VS 2005
So how do we suppress the messages? You most likely see these messages in
Immediate Window because you have set Redirect all Output Window text to the
Immediate Window in Tools - Options… - Debugging - General. That’s why when you
right-click in Immediate Window, you cannot see any option to disable messages.
It’s Output Window text and thus you need to set it in the Output Window. So
open Output Window, right-click and uncheck Exception Messages from context
menu. Simple but it took me one hour to find it.

It was just a simple context menu option on the Output window: Uncheck the 'Exception Messages'.

I was always trying to do this somewhere in the Debug \ Exceptions form. Well I'm glad I found it. It makes the Output windows trace less convoluted with irrelevant messages.

No comments: