For debugging environments, we have a conditional Debugger.Launch statement in the code to allow developers to debug into the startup code of the windows service. We just upgraded to .NET 4.0. Since the upgrade, if we exit out of the JIT window (i.e. we chose not to debug), the Windows Service crashes (process is terminating). It used to simply resume. If we accept to attach, the application does not terminate and works fine.
Another strange thing is that the exception that is thrown is no longer a Launch for User exception. It is now an unhandled Microsoft .NET framework exception. I've tried to wrap a try catch arround it to see what i get. I can't catch the exception when i'm debugged in because at that point the exception doesn't occur. If i try to log the exception to a file, the Service crashes and i get nothing.
This is apparently pretty easy to reproduce. It has occured on multiple systems in house and I've received confirmation from an external party that the problem can be reproduced simply by using the code snippet above in a .NET windows form that uses .NET 4.0