DelphiFAQ Home Search:
General :: Programming :: Delphi
General Delphi related information.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

Assertions are not working?

Does it seem that Assertions are not working? Do violate assertions not cause a 'break'?

If an assertion is violated within a try..except block, and you simply eat the exceptions, then you will not see the violation.
The reason is clear.. the assertion generates an EAssertionFailure exception which is eaten if you are running outside the IDE or in the IDE with

try
   assert(false, 'Always a Violation');
   myCode();
 except
   on E:EMyException do ShowMessage('myCode() failed');
   else Raise; // this line is important!
 end;

Generated 20:01:51 on Apr 19, 2019