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 ;)
}
精彩评论