When an exception stops a program that is being debugged, it highlights the line that is currently being executed and presumably has the error. However, this is only rarely the actual line with the problem. In practice, running the program through a shell, where the full traceback is visible, is necessary in order to find the correct line.
For example:
IronPython.Runtime.UnboundNameException was unhandled by user code
Message=global name 'crash' is not defined
Source=IronPython
StackTrace:
at IronPython.Compiler.PythonGlobal.GetCachedValue(Boolean lightThrow)
at IronPython.Compiler.PythonGlobal.get_CurrentValue()
at __main__$1.show_face_down$76(PythonFunction $function, Object self, Object x, Object y, Object card) in C:\Documents\Administrator\My Documents\Visual Studio 2010\Projects\Lab3\Lab3\Program.py:line 79
at IronPython.Runtime.PythonFunction.FunctionCaller`4.Call4(CallSite site, CodeContext context, Object func, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at IronPython.Runtime.Method.MethodBinding`3.SelfTarget(CallSite site, CodeContext context, Object target, T0 arg0, T1 arg1, T2 arg2)
at System.Dynamic.UpdateDelegates.UpdateAndExecute5[T0,T1,T2,T3,T4,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
at __main__$1.update_display$74(PythonFunction $function, Object self) in C:\Documents\Administrator\My Documents\Visual Studio 2010\Projects\Lab3\Lab3\Program.py:line 64
at IronPython.Runtime.PythonFunction.FunctionCaller`1.Call1(CallSite site, CodeContext context, Object func, T0 arg0)
at IronPython.Runtime.Method.MethodBinding.SelfTarget(CallSite site, CodeContext context, Object target)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at __main__$1.__init__$72(PythonFunction $function, Object self) in C:\Documents\Administrator\My Documents\Visual Studio 2010\Projects\Lab3\Lab3\Program.py:line 41
at Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
InnerException:
With this exception, Visual Studio highlights line 41 in the program (the last - highest - line in the trace), but should highlight line 79 (the first - lowest - line in the trace).