开发者

Assertions in Windows Services

I'd like to assert using _ASSERTE in a backend Windows service code. But as I understand, the default behaviour will hang the service because of the message box.

What is the best way to safely do assertions in a Windows service?

Edit: I should've mentioned that code should still use the nor开发者_JAVA技巧mal behaviour, if running in the console mode; for example when being unit tested.


Simply write your own assert function.

void assert(bool condition)
{
    //Stop service and log failure to event log here ;)
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜