I am using Delphi 11 with the DUnitx unit testing. I know that I can turn off "Language Exceptions" in Tools/Options. But this turns it off for all projects.
Is there a way to turn them off for "unit testing", or "per project".
I am using Delphi 11 with the DUnitx unit testing. I know that I can turn off "Language Exceptions" in Tools/Options. But this turns it off for all projects.
Is there a way to turn them off for "unit testing", or "per project".
The only way I know of to accomplish this, in all Delphi versions, is by using breakpoints.
Put a breakpoint at the point in the code where you want to disable the debugger's exception handling. Right-click on the breakpoint to go into its properties. In the "Advanced" options, turn off the Break
option and turn on the Ignore subsequent exceptions
option.
Place another breakpoint at the point in the code where you want to re-enable the debugger's exception handling. In the properties, turn off the Break
option and turn on the Handle subsequent exceptions
option.
Now run the code, and you can debug as needed, except for the code you masked off.
GExperts has got an expert that can filter specific exceptions, not just by exception type but also depending on the message. And it's project specific. I'm not sure how well this works with Delphi 11 though.
It also has a side effect: The IDE gets the focus for each of the exceptions and will then switch back to the program. This makes the computer nearly unusable if there are many exceptions.
If you use DUnitx for testing, then I would recommend using TestInsight. This is a very good way to implement the unit testing into the Delphi IDE.
The Testinsight plugin compiles the test program and runs it without the debugger.
Or simply run your test program without the debugger: Ctrl+Shift+F9