I've tried to reproduce it with both the GUI and the console and I actually get a different outcome than what you described. None of them crashes but the agent process' death is causing some confusion indeed, and I don't even get a stackoverflow if the test assembly is compiled with optimizations. I didn't inspect the IL but I guess the compiler is transforming the recursive call into a loop.
Regardless, I'm not sure it's really worth handling this case though, it sounds like a quite uncommon scenario.
I've tried to reproduce it with both the GUI and the console and I actually get a different outcome than what you described. None of them crashes but the agent process' death is causing some confusion indeed, and I don't even get a stackoverflow if the test assembly is compiled with optimizations. I didn't inspect the IL but I guess the compiler is transforming the recursive call into a loop.
Regardless, I'm not sure it's really worth handling this case though, it sounds like a quite uncommon scenario.