public void Defect_1467570_Crash_In_Debug_Mode() { string src = @" class Test { IntArray : int[]; constructor FirstApproach(intArray : int[]) { IntArray = intArray; } def Transform(adjust : int) { return = Test.FirstApproach(this.IntArray + adjust); } } myTest = Test.FirstApproach({ 1, 2 }); myNeTwst = myTest.Transform(1); "; fsr.PreStart(src, runnerConfig); DebugRunner.VMState vms = fsr.Step(); // myTest = Test.FirstApproach({ 1, 2 }); ProtoCore.CodeModel.CodePoint cp = new ProtoCore.CodeModel.CodePoint { LineNo = 15, CharNo = 5 }; fsr.ToggleBreakpoint(cp); fsr.Run(); // line containing "this" ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, null); ExecutionMirror mirror = watchRunner.Execute(@"this"); Obj objExecVal = mirror.GetWatchValue(); Assert.AreNotEqual(null, objExecVal); Assert.AreNotEqual(null, objExecVal.Payload); Assert.AreEqual(mirror.GetType(objExecVal), "Test"); vms = fsr.StepOver(); watchRunner = new ExpressionInterpreterRunner(core, null); mirror = watchRunner.Execute(@"this"); objExecVal = mirror.GetWatchValue(); Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(-1, (Int64)objExecVal.Payload); Assert.AreEqual(mirror.GetType(objExecVal), "null"); }
public void Defect_1467570_Crash_In_Debug_Mode() { string src = @" class Test { IntArray : int[]; constructor FirstApproach(intArray : int[]) { IntArray = intArray; } def Transform(adjust : int) { return = Test.FirstApproach(this.IntArray + adjust); } } myTest = Test.FirstApproach({ 1, 2 }); myNeTwst = myTest.Transform(1); "; // Tracked by http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-3989 string defectID = "MAGN-3989 Inspection of 'this' pointer has issues in expression interpreter"; fsr.PreStart(src); DebugRunner.VMState vms = fsr.Step(); // myTest = Test.FirstApproach({ 1, 2 }); ProtoCore.CodeModel.CodePoint cp = new ProtoCore.CodeModel.CodePoint { LineNo = 15, CharNo = 5 }; fsr.ToggleBreakpoint(cp); fsr.Run(); // line containing "this" ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); ExecutionMirror mirror = watchRunner.Execute(@"this"); Obj objExecVal = mirror.GetWatchValue(); Assert.AreNotEqual(null, objExecVal); Assert.AreNotEqual(null, objExecVal.Payload, defectID); Assert.AreEqual(mirror.GetType(objExecVal), "Test"); vms = fsr.StepOver(); watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore); mirror = watchRunner.Execute(@"this"); objExecVal = mirror.GetWatchValue(); Assert.AreNotEqual(null, objExecVal); Assert.AreEqual(-1, (Int64)objExecVal.Payload, defectID); Assert.AreEqual(mirror.GetType(objExecVal), "null"); }
internal bool GetStackValueType(ProtoCore.Lang.Obj stackValue, ref string type) { type = string.Empty; if ((null != internalWorker) && internalWorker.IsBusy) { return(false); } if (null == currentWatchedMirror) { return(false); } try { type = currentWatchedMirror.GetType(stackValue); } catch (Exception exception) { HandleException(exception); return(false); } return(true); }