I have a C# windows service . when I try to stop it goes in stopping state and when I placed the break point in onStop method then it is not getting hit. Not able to debug what is problem. I have added exception handling all over the service and also unhandled exception handling but I don't get any error. Every thing is fine with the servie it has canStop set to true and also uses RequestAdditionalTime() .
I have also set legacyUnhandledExceptionPolicy enabled="true" in app.config. But of no help.
For me it looks like some threading/resource issue that prevent service control manager to call the OnStop method. Or the service may be in already corrupt state and service control manager can not stop it. It just change the state from Stop to Stopping.
When I try debugging by attaching code to service exe nothing happens when try to stop the service. The onstop method is not getting called.
In Onstart method starts a thread that keep doing a kind of polling on every 30 second. Suppose onStop method gets called then it will abort this thread. This is how this service is developed.
Can someone please advice me on how to debug this issue?
Is there some free tools available to debug if there is some threading issue or my thread in OnStart method is chocking the resource available to service control manager?
Kindly help me it's urgent.