Visual Studio 2010 random crash


I have been noticing lately when I have been editing unrelated files that I get random crashes in VS 2010.

I finally checked the event viewer and received the following stack trace.

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AggregateException
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean)
at System.Threading.Tasks.Task.Wait(Int32, System.Threading.CancellationToken)
at Microsoft.PythonTools.Interpreter.Default.CPythonInterpreter.OnNewDatabaseAvailable(System.Object, System.EventArgs)
at Microsoft.PythonTools.Interpreter.PythonInterpreterFactoryWithDatabase.OnNewDatabaseAvailable()
at Microsoft.PythonTools.Interpreter.PythonInterpreterFactoryWithDatabase.NotifyNewDatabase()
at Microsoft.PythonTools.Interpreter.PythonInterpreterFactoryWithDatabase.OnDatabaseVerChanged(System.Object, System.IO.FileSystemEventArgs)
at System.IO.FileSystemWatcher.OnChanged(System.IO.FileSystemEventArgs)
at System.IO.FileSystemWatcher.NotifyFileSystemEventArgs(Int32, System.String)
at System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32, UInt32, System.Threading.NativeOverlapped*)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

I did have one .py file open at the time but I was editing a .cpp file at the time of the crash.

Any thoughts or possible solutions?


Zooba wrote Apr 21 at 6:56 PM

Does your Python file/project reference any .pyd files that you may have been working on?

It's hard to see exactly what is causing the crash - an AggrerateException actually contains the real exception, so we can't see what it is without a debugger - but it looks like this code path is only going to be hit if your have added a reference to a .pyd file.

You can probably avoid the crashes by removing the reference (though you'll lose IntelliSense). Meanwhile, I'll see if we've had any crash dumps sent in for this issue.

rpastrick wrote Apr 21 at 7:26 PM

I'm not exactly sure if it is referenced or not. The cpp file I was working on will eventually be compiled (through SWIG) into a pyd that is referenced by a python project loaded into my current solution.

I was not actively editing the python file at the time. I just had it open as I was working on the cpp.

After I closed the .py file, I've not seen any more of the crashes.

Zooba wrote Apr 22 at 3:48 PM

Thanks. We can certainly strengthen this part of the code so it never crashes.

I suspect this is actually an "expected" error that we are supposed to be handling and reporting - my guess is that the .pyd file we are detecting is invalid or inaccessible when this code runs (in the background, so you can't control it).

rpastrick wrote Jun 13 at 4:53 PM

As this has been marked resolved, is there a beta version that this fix has been incorporated into that I can try?


Zooba wrote Jun 13 at 6:36 PM

The latest dev build is the best hope you've got, though in this case the last time we released one of those was before this fix went in (the linked page has a changeset linked on it, so you can see where in the history this fix went in).

We're hoping to release an update to that today or Monday, but Beta 2 is not far away.