|
13.01.2009, 20:05 | #1 |
Участник
|
gatesasbait: Exception::Break in while loop
Источник: http://gatesasbait.spaces.live.com/B...B9F5!290.entry
============== Good morning I noticed something interesting yesterday. When breaking execution while running a loop (by pressing ctrl-break) an Exception::Break is thrown if 'Yes' is clicked on the resulting break prompt. Sometimes even if the exception is caught, the execution stops, other times it will continue with no apparent reason. Here's the example: public static void whileBreak(Args _args) { int i = 1; #define.dosomething(i++; i--;) ; while (i < 1000000) { try { i++; #dosomething sleep(50); #dosomething } catch (Exception::Break) { info("Break caught."); } } } If we want to be sure the execution will stop, we need to add another 'throw' inside the 'catch' statement. Also note that adding any breakpoint seem to change the behavior of the try-catch. Источник: http://gatesasbait.spaces.live.com/B...B9F5!290.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|