Topshelf / Topshelf

An easy service hosting framework for building Windows services using .NET
http://topshelf-project.com/
Apache License 2.0
3.58k stars 690 forks source link

Make an option to crash the process on unhandled exception #189

Closed fandrei closed 8 years ago

fandrei commented 10 years ago

Currently, Topshelf attempts to prevent the process crashing on unhandled exception (by using an infinite cycle in the unhandled exceptions handler event) https://github.com/Topshelf/Topshelf/blob/master/src/Topshelf/Hosts/ConsoleRunHost.cs#L163

Sometimes, this behavior makes the program work incorrectly. Is it possible to make an option to turn this behavior off?

TravisTheTechie commented 10 years ago

Can you describe what the incorrect behaviour is in more detail? If it's a bug, maybe we can just fix it. What version are you using?

fandrei commented 10 years ago

@TravisTheTechie,

Version 3.1.3

  1. Using this behavior Topshelf freezes the thread, where an unhandled exception occurred. And this prevents the whole application from working correctly. In this case, it's better to crash the application and restart it.
  2. I'm not sure why exactly, but this doesn't work well under Mono. The process still is terminated, but without error code.