This project has moved and is read-only. For the latest updates, please go here.

PTVS crashing VS2010 upon code edit.

Nov 14, 2011 at 1:58 PM

So I was working on this program for some UI Automation Testing software I am writing using IronPython and White. However, I am finding an interesting issue, but I wanted to discuss it first because I am not even sure if this is PTVS or VS2010. However, there are the two relevant source files that produce the error. I do ask, however, that even though this is code I am writing and have permission to release here for the purpose of helping the development of PTVS and to fix this bug, that I did technically write this code for work. Please respect it as such.

Anywho, first we have the first file module called which remains untouched throughout the recreation of this bug. Here it is:



Created on Oct 18, 2011

@author: Greg Chambers <>

import time

class ApsMessageHandler(Object):

    def __init__(self, apsApp):
        self.__app = apsApp
        self.__mainWin = apsApp.GetWindow("APS Simulator")
        portEdit = apsWin.Get(SearchCriteria.ByControlType("TextBox"))
        portEdit.Text = "9500"
        listenBtn = apsWin.Get(SearchCriteria.ByText("Listen"))
    def execRODB(self, rodbEvent):
        Takes an RODB event and sends the message for it.

        #Constants for the Item indexs of input fields in RODB window.
        TRAN_ID = 5
        PORTAL = 7
        START_TIME = 10
        END_TIME = 12
        TYPE = 14
        NAME = 17
        ORIENTATION = 19
        WELLS = 21
        AXLES = 23
        LENGTH = 25
        ENGINE = 26
        GHOST = 27
        UNIQUE_ID = 29
        OK = 30

        #Creating and attaching the RODB window with resource references
        rodbWin = self.__app.GetWindow("RODB")
        rodbItems = list(rodbWin.Items)
        #Inputing data into fields
        # Note that edit boxes are a simple data assignment but
        # drop down lists require some odd things including a short sleep time.
        # I am assuming the sleep timer is due to the expanding list animation.
        rodbItems[TRAN_ID].Text = rodbEvent.find("TranId").text
        rodbItems[PORTAL].Text = rodbEvent.find("Portal").text
        moveElem = rodbEvent.find("Move")
        rodbItems[START_TIME].Text = moveElem.find("StartTime").text
        rodbItems[END_TIME].Text = moveElem.find("EndTime").text
        if(moveElem.find("Type").text == "OUTBOUND"):
        carElem = rodbEvent.find("Car")
        rodbItems[NAME].Text = carElem.find("Name").text
        rodbItems[UNIQUE_ID].Text = carElem.find("UniqueId").text
        if(carElem.find("Orientation").text == "A"):
        elif(carElem.find("Orentation").text == "B"):
        rodbItems[WELLS].Text = carElem.find("Wells").text
        rodbItems[AXLES].Text = carElem.find("Axles").text
        rodbItems[LENGTH].Text = carElem.find("Length").text
        if(carElem.find("IsEngine").text == "True"):
        if(carElem.find("IsGhost").text == "True"):



For the next file module we have This is the one that is changed to reproduce the error:



Created on Oct 18, 2011

@author: Greg Chambers <>

import clr
from White.NUnit import *
from White import *
from White.Core import *
from White.Core.Configuration import *
from White.Core.UIItems import *
from White.Core.UIItems.WindowItems import *
from White.Core.UIItems.ListBoxItems import *
from White.Core.UIItems.Container import *
from White.Core.UIItems.Finders import *
from White.Core.Factory import *
from White.Core.Finder import *
from White.Core.AutomationElementSearch import *
from White.Core.WindowsAPI import *

from xml.etree.ElementTree import ElementTree

from code.controller.automation.ApsMessageHandler import ApsMessageHandler

class AutoDirector(object):
    This class acts as a caller class for the chain that will execute the
    script events.

    def __init__(self):
        #General path to applications
        simPath = "C:\\Users\\gchambers\\Documents\\Car Tracking Simulators\\Car Tracking Simulators\\"
        #APS Simulator Setup
        apsPath = simPath + "APS Simulator\\APS Simulator.exe"
        apsApp = Application.Launch(apsPath)
        self._apsHandler = AspMessageHandler(apsApp)
        # Car Tracking Setup
        #ctPath = simPath + "Car Tracking Simulator\\Car Tracking Simulator.exe"
        #ctApp = Application.Launch(ctPath)
        #self._ctLoadHandler = LoadScriptHandler(ctApp)
    def runScript(self):
        Takes in a script after merging and splits it into a list of sections.
        This is to bunch up the AxleRead events together as well as any other
        events that need to be bunched and processed as a single automation
        event. It then takes each event and feeds them into the first handler,
        one by one, to be executed.
        aTree = ElementTree().parse("C:\\RCDOC\\Automation\\ScriptMerged.xml")
        rodbEvent = aTree.find("ApsMessage")

if __name__ == "__main__":
    autoDir = AutoDirector()
Now a sharp eye will notice that on line 45 of that file, I misspelled the name of the ApsMessageHandler class as AspMessageHandler. So I went to go fix it. Upon correcting the error, about three seconds later, Visual Studios 2010 just disappears entirely and without a trace. No error message, nothing from the OS saying the program has stopped responding, nothing at all.
Can anyone else recreate this?


Nov 14, 2011 at 2:24 PM

Sorry to double post. I just wanted to also say that I was able to recreate this error multiple times within my own development environment in both the stable 1.0 release and the alpha 1.1 release of PTVS. The only difference in behavior is that while alpha 1.1 release just disappears in a blink, stable 1.0 shows a waiting icon for a few seconds before disappearing.

I also wanted to mention that I also tried changing the code in an external editor and then pasting it back in, as well as deleting the file, recreating the file with an external editor, and then importing it. In all cases, the moment the new code is brought into the project (probably upon parsing for data structure) Visual Studios crashes and disappears.

So in the meantime, is there anything I can do to get around this?

Nov 14, 2011 at 6:21 PM

I'll see if I can repro it (you could open an issue to make sure this doesn't get lost) but one possible way to figure out what the issue is would be to look in EventVwr and see if there's a crash report - if there is posting the contents back here may be helpful.  Another option is if you can attach another copy of Visual Studio to Visual Studio before doing the repro, do the repro steps, and then the VS which is attached should break into the debugger when it crashes.  Reporting back the stack trace here would help us track down the issue. 

Nov 14, 2011 at 6:37 PM

Got it:

- <Event xmlns="">
- <System>
  <Provider Name=".NET Runtime" />
  <EventID Qualifiers="0">1026</EventID>
  <TimeCreated SystemTime="2011-11-14T14:17:38.000000000Z" />
  <Security />
- <EventData>
  <Data>Application: devenv.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException Stack: at System.Signature.GetSignature(System.SignatureStruct ByRef, Void*, Int32, System.RuntimeFieldHandleInternal, System.IRuntimeMethodInfo, System.RuntimeType) at System.Signature..ctor(System.IRuntimeMethodInfo, System.RuntimeType) at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters() at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy() at System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy() at System.Reflection.RuntimePropertyInfo.GetIndexParameters() at Microsoft.Scripting.Actions.ReflectedPropertyTracker.GetIndexParameters() at IronPython.Runtime.Types.TypeInfo.FilterSpecialNames(Microsoft.Scripting.Actions.MemberGroup, System.String, Microsoft.Scripting.Actions.MemberRequestKind) at IronPython.Runtime.Types.TypeInfo+StandardResolver.ResolveMember(MemberBinder, Microsoft.Scripting.Actions.MemberRequestKind, System.Type, System.String) at IronPython.Runtime.Types.TypeInfo+MemberResolver.ResolveMembers(MemberBinder, Microsoft.Scripting.Actions.MemberRequestKind, System.Type) at IronPython.Runtime.Types.TypeInfo.GetResolvedMembers(MemberBinder, Microsoft.Scripting.Actions.MemberRequestKind, System.Type) at IronPython.Runtime.Binding.PythonBinder.ResolveMemberNames(IronPython.Runtime.CodeContext, IronPython.Runtime.Types.PythonType, IronPython.Runtime.Types.PythonType, System.Collections.Generic.Dictionary`2<System.String,System.String>) at IronPython.Runtime.Types.PythonType.GetMemberNames(IronPython.Runtime.CodeContext, System.Object) at IronPython.Runtime.Types.PythonType.IronPython.Runtime.IPythonMembersList.GetMemberNames(IronPython.Runtime.CodeContext) at IronPython.Runtime.Operations.PythonOps.GetAttrNames(IronPython.Runtime.CodeContext, System.Object) at IronPython.Runtime.ClrModule.Dir(System.Object) at Microsoft.IronPythonTools.Interpreter.IronPythonInterpreter.DirHelper(System.Object, Boolean) at Microsoft.IronPythonTools.Interpreter.PythonObject`1[[System.__Canon, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]].IsVisible(System.String, Boolean) at Microsoft.IronPythonTools.Interpreter.PythonObject`1[[System.__Canon, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetOne(System.String, Boolean) at Microsoft.IronPythonTools.Interpreter.PythonObject`1[[System.__Canon, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetMember(Microsoft.PythonTools.Interpreter.IModuleContext, System.String) at Microsoft.PythonTools.Analysis.Values.BuiltinNamespace`1[[System.__Canon, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetMember(Microsoft.PythonTools.Parsing.Ast.Node, Microsoft.PythonTools.Analysis.Interpreter.AnalysisUnit, System.String) at Microsoft.PythonTools.Analysis.Values.BuiltinInstanceInfo.GetMember(Microsoft.PythonTools.Parsing.Ast.Node, Microsoft.PythonTools.Analysis.Interpreter.AnalysisUnit, System.String) at Microsoft.PythonTools.Analysis.Values.NamespaceSetExtensions.GetMember(System.Collections.Generic.ISet`1<Microsoft.PythonTools.Analysis.Values.Namespace>, Microsoft.PythonTools.Parsing.Ast.Node, Microsoft.PythonTools.Analysis.Interpreter.AnalysisUnit, System.String) at Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator.EvaluateMember(Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator, Microsoft.PythonTools.Parsing.Ast.Node) at Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator.EvaluateWorker(Microsoft.PythonTools.Parsing.Ast.Node) at Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator.EvaluateCall(Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator, Microsoft.PythonTools.Parsing.Ast.Node) at Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator.EvaluateWorker(Microsoft.PythonTools.Parsing.Ast.Node) at Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator.EvaluateMember(Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator, Microsoft.PythonTools.Parsing.Ast.Node) at Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator.EvaluateWorker(Microsoft.PythonTools.Parsing.Ast.Node) at Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator.EvaluateCall(Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator, Microsoft.PythonTools.Parsing.Ast.Node) at Microsoft.PythonTools.Analysis.Interpreter.ExpressionEvaluator.EvaluateWorker(Microsoft.PythonTools.Parsing.Ast.Node) at Microsoft.PythonTools.Analysis.Interpreter.DDG.Walk(Microsoft.PythonTools.Parsing.Ast.ExpressionStatement) at Microsoft.PythonTools.Parsing.Ast.ExpressionStatement.Walk(Microsoft.PythonTools.Parsing.Ast.PythonWalker) at Microsoft.PythonTools.Parsing.Ast.SuiteStatement.Walk(Microsoft.PythonTools.Parsing.Ast.PythonWalker) at Microsoft.PythonTools.Analysis.Interpreter.FunctionAnalysisUnit.AnalyzeWorker(Microsoft.PythonTools.Analysis.Interpreter.DDG) at Microsoft.PythonTools.Analysis.Interpreter.DDG.Analyze(Microsoft.PythonTools.Analysis.Deque`1<Microsoft.PythonTools.Analysis.Interpreter.AnalysisUnit>) at Microsoft.PythonTools.Analysis.PythonAnalyzer.Microsoft.PythonTools.Analysis.IGroupableAnalysisProject.AnalyzeQueuedEntries() at Microsoft.PythonTools.Library.Intellisense.AnalysisQueue+GroupAnalysis.Analyze() at Microsoft.PythonTools.Library.Intellisense.AnalysisQueue.Worker() at System.Threading.ThreadHelper.ThreadStart_Context(System.Object) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart()</Data>

Nov 14, 2011 at 7:01 PM

I suspect what's happening here is that there are some dependencies between your assemblies and we're unable to find one of those dependencies.  In particular it's probably an indexer like (or it could be an indexer defined in VB where these are more commonly seen if you're talking to VB code):

public MaybeYourTypeHere Foo[OrMaybeYourTypeHere value] {

    get {


    set {



We can certainly handle the exception from IronPython and the CLR so that we don't crash VS, but you might also be able to work around it by making sure all of the assemblies are loadable. 

That could be as simple as adding some more clr.AddReference(...) calls to any additional assemblies, or it might be that you'll need to install the assemblies into the GAC - the latter is probably only a good idea if you're not re-building the assemblies on a regular basis. 

If you can build PTVS from source you can add a try/catch into the IronPythonInterpreter.DirHelper method so that it just works off an empty list if it the exception occurs, I put this into a seperate function like (note I may have some other changes in here, I'm doing some other work for IronPython right now and just made this in the same enlistment): 

    internal static IList<string> DirHelper(object obj, bool showClr) {
            NamespaceTracker nt = obj as NamespaceTracker;
            if (nt != null) {
                return nt.GetMemberNames();

            var dir = TryDir(obj, showClr);
            int len = dir.__len__();
            string[] result = new string[len];
            for (int i = 0; i < len; i++) {
                // TODO: validate
                result[i] = dir[i] as string;
            return result;

        private static List TryDir(object obj, bool showClr) {
            try {
                return showClr ? ClrModule.DirClr(obj) : ClrModule.Dir(obj);
            } catch {
                // Work around exceptions coming out of IronPython and the CLR
                return new List();

 If you can't rebuild from source the fix will be in the next release which is currently scheduled to be around late November/early December.

Nov 14, 2011 at 7:06 PM

Well, the assemblies I am referencing to are the ones located at as part of project White. I just downloaded it and put the assemblies in IronPython's DLL folder. Seems to work fine from Eclipse but my place of work would rather have me use Visual Studios.

Anyways, thanks for the info!