开发者

Is it possible to install custom unhandled exception handler while debugging in VS 2008/2010?

I'm working on an utility that processes very large data sets. Since there are lots of code it uses to operate, some tot开发者_开发百科ally unexpected errors appear while running. So I run it inside Visual Studio debugging session. In most cases I can skip an error or recover from it using immediate window and some manipulation with "Set next statement". But this error can reoccur in future. Is it possible to automatize recovering process without restarting debugging session?


Depending on the structure of your code and the language you are using you may be able to do something similar with Conditional Breakpoint abuse.

The idea is to use the Breakpoint condition to do an evaluation, basically an automated way of doing what you do in the immediate window.

int c = a + b; // some type of calculation

if (c == 5) // your test { // ERROR return; }

E.g. If you know the test c==5 is what is going wrong you can place a Conditional Breakpoint at that line:

if (c == 5) // your test

With the expression of some correct value:

c = 1

And then you won't go down the error condition path. Of course this doesn't always work, but can be useful in come circumstances.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜