Remove Debugger.IsAttached restriction


Can you please remove the restriction if (Debugger.IsAttached) in ServiceRunner.cs? I sometimes want to test without the debugger attached, but without installing the service proper. Currently, I have to start
it debugging, then "Detach All".

I'm not sure why this is even really required, other than to discourage using it in production, but that's heavy-handed IMHO.


scavic wrote Feb 5, 2013 at 12:50 PM


I would suggest adding a public static boolean property ForceTestMode (or similar) to the ServiceRunner class in ServiceRunner.cs, and then change the if-condition "if (Debugger.IsAttached)" to "if (Debugger.IsAttached || ForceTestMode)".

That way there is a really small change in the source code, it doesn't encourage using the test mode when not debugging, but when one really want to force this mode, one can still use the NuGet package.

I would happily create a patch if there is any interest to update the NuGet package with it.