WCF singleton crashes Visual Studio

Tags: WCF, VS2015, Visual Studio, singleton

Found an interesting crash in VS2015. I reported it on the MSDN forums. Essentially, devenv.exe itself actually instantiates WCF singletons in your solution. It does so even if they aren't being hosted by your startup project(s), in fact even if they are in projects not even referenced by your startup projects. And, if devenv.exe's constructing of your singletons causes an exception, Visual Studio crashes. In my case, the singleton was dependent upon my host project's config goo, and from the context of devenv.exe this didn't exist, thus an exception and crash.

The workaround is not to have parameterless (default) constructors for your singletons. Introduce a dummy argument and then devenv.exe won't perform this voodoo, leaving you back in control.

To find this I actually had to run another instance of VS2015 and attach it to the other VS2015 instance. Debugging the debugger makes me feel so meta.

No Comments

Add a Comment