Well, all those
A first chance exception of type 'System.ArgumentException' occurred in MyAssembly.dll
messages in my Immediate window during the debugging annoyed me for a long time. Today, I said: enough! There must be a way how to tell VS not to show them.
We know that first chance exceptions don’t necessarily need to be dangerous. See What is a First Chance Exception? and First and second chance exception handling. I’m using exceptions very often and I handle all of them very carefully. There never appears second chance exception in my code. I’m getting exceptions when trying to add duplicate item to hashtable or trying to get the item with the key which doesn’t exist in custom collection. Doing it in countless loops, I’m getting hundreds of warnings at debug time. Some may say that this is poor design. Yes, I could use millions of
If ... Then checks to avoid exceptions but I think that avoiding this is one of the exceptions purposes.
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.