void DoMonitor ()
{
try {
Setup ();
} catch (Exception e) {
exc = e;
} finally {
startedEvent.Set ();
}
if (exc != null) {
fsw.DispatchErrorEvents (new ErrorEventArgs (exc));
return;
}
try {
Monitor ();
} catch (Exception e) {
exc = e;
} finally {
CleanUp ();
if (!requestStop) { // failure
started = false;
inDispatch = false;
fsw.EnableRaisingEvents = false;
throw exc;
}
if (exc != null)
fsw.DispatchErrorEvents (new ErrorEventArgs (exc));
requestStop = false;
}
}