{"action":"closed","issue":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/3542","repository_url":"https://api.github.com/repos/Particular/NServiceBus","labels_url":"https://api.github.com/repos/Particular/NServiceBus/issues/3542/labels{/name}","comments_url":"https://api.github.com/repos/Particular/NServiceBus/issues/3542/comments","events_url":"https://api.github.com/repos/Particular/NServiceBus/issues/3542/events","html_url":"https://github.com/Particular/NServiceBus/issues/3542","id":137880572,"number":3542,"title":"V5: StackoverflowException when using DefineCriticalErrorAction ","user":{"login":"ramonsmits","id":152998,"avatar_url":"https://avatars.githubusercontent.com/u/152998?v=3","gravatar_id":"","url":"https://api.github.com/users/ramonsmits","html_url":"https://github.com/ramonsmits","followers_url":"https://api.github.com/users/ramonsmits/followers","following_url":"https://api.github.com/users/ramonsmits/following{/other_user}","gists_url":"https://api.github.com/users/ramonsmits/gists{/gist_id}","starred_url":"https://api.github.com/users/ramonsmits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramonsmits/subscriptions","organizations_url":"https://api.github.com/users/ramonsmits/orgs","repos_url":"https://api.github.com/users/ramonsmits/repos","events_url":"https://api.github.com/users/ramonsmits/events{/privacy}","received_events_url":"https://api.github.com/users/ramonsmits/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Particular/NServiceBus/labels/Type:%20Bug","name":"Type: Bug","color":"e10c02"},{"url":"https://api.github.com/repos/Particular/NServiceBus/labels/Withdrawn:%20Won't%20Fix","name":"Withdrawn: Won't Fix","color":"cccccc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-02T13:58:52Z","updated_at":"2016-03-11T12:50:10Z","closed_at":"2016-03-11T12:50:10Z","body":"Setting a custom critical error handler will result in a `StackoverflowException` when the circuitbreaker trips.\r\n\r\nhttp://docs.particular.net/nservicebus/hosting/critical-errors#a-possible-custom-implementation\r\n\r\n    BusConfiguration busConfiguration = new BusConfiguration();\r\n    busConfiguration.DefineCriticalErrorAction(OnCriticalError);\r\n\r\n## Expected behavior\r\n\r\nThe callback should result in the ability to recover from a circuit breaker activation. Recover as in, dispose all occupied resources by the instance and possibly swap the bus instance with a fresh newly created instance.\r\n\r\n\r\n## How to reproduce\r\n\r\n1. Open [pubsub sample](http://docs.particular.net/samples/pubsub/)\r\n2. Add empty `DefineCriticalErrorAction(..)`\r\n3. Start endpoint\r\n4. Stop or kill the MSMQ service\r\n\r\nNow you get the  `StackoverflowException` and the process dies.\r\n\r\n## References\r\n\r\n- https://groups.google.com/forum/#!topic/particularsoftware/VgXe9wHM0o4"}}