Can I run a program that heavily uses exceptions in the debugger and not catch the exceptions in the debugger?
Specifically I'm trying to use the TSQL ScriptDOM parser, and I understand that it's use of ANTLR is slow in debug mode.
It is not that strange if you look at the debug output, you will find that this is caused by the Microsoft® SQL Server® 2012 Transact-SQL ScriptDom parser, since this is based on the ANTLR framework, it unrolls AST productions using exceptions, this is what it makes it slow when running inside the debugger.
I completely understand that .net exceptions are slow when thrown
How can I avoid the slowness when running with the standard DEBUG configuration, with the debugger attached?
- I've disabled intellitrace.
- I've undefined the DEBUG constant.
- I've turned off exception messages in the Tools > Options > Debugging > Output Window.
What else can I try?
- a CLR setting I can change via the app.config?
- an option to change in Visual Studio?
This is the specific code I am using for parsing.
TSqlParser parser = new TSql110Parser(false);
IList<ParseError> errors;
TSqlFragment fragment = parser.Parse(new StringReader(sqltext), out errors);
When run using CTRL+F5 it finishes quickly, and using F5 (debugger attached), I give up waiting.