One thing I just noticed is that if I run your code outside a debugger (be it VisualStudio or EiffelStudio) the program does not crash. Can you confirm this too? If this is the case, then it is clearly a Microsoft bugs. Debugging it when it failed showed that most likely there is either a problem with global variable or with WeakReference. It is hard for me to tell which one since although reproducible, it is always happening to a different object.