object EvaluateExpression(ScriptingContext context, string expression) { try { Expression expr = context.ParseExpression(expression); expr = expr.Resolve(context); if (expr == null) { Assert.Fail("Cannot resolve expression `{0}'.", expression); } object obj = expr.Evaluate(context); if (obj == null) { Assert.Fail("Failed to evaluate expression `{0}.", expression); } return(obj); } catch (ScriptingException) { throw; } catch (AssertionException) { throw; } catch (Exception ex) { Assert.Fail("Failed to evalaute expression `{0}': {1}", expression, ex); return(null); } }
TargetType EvaluateExpressionType(ScriptingContext context, string expression) { try { Expression expr = context.ParseExpression(expression); Expression resolved = expr.TryResolveType(context); if (resolved != null) { expr = resolved; } else { expr = expr.Resolve(context); } if (expr == null) { Assert.Fail("Cannot resolve expression `{0}'.", expression); } return(expr.EvaluateType(context)); } catch (ScriptingException) { throw; } catch (AssertionException) { throw; } catch (Exception ex) { Assert.Fail("Failed to evalaute type of expression `{0}': {1}", expression, ex); return(null); } }
public void AssertTypeException(Thread thread, string expression, string exp_result) { string text = null; try { ScriptingContext context = GetContext(thread); TargetType type = EvaluateExpressionType(context, expression); text = context.FormatType(type); Assert.Fail("Evaluation of expression `{0}' failed to throw " + "exception {1}.", expression, exp_result); } catch (AssertionException) { throw; } catch (ScriptingException ex) { text = ex.Message; } catch (Exception ex) { Assert.Fail("Failed to print expression `{0}': {1}", expression, ex); } if (text != exp_result) { Assert.Fail("Expression `{0}' evaluated to `{1}', but expected `{2}'.", expression, text, exp_result); } }
protected override object DoExecute(ScriptingContext context) { // try-catch: on exceptions, we must release the semaphore try { EmonicInterpreter.localsOutput = ""; foreach (TargetVariable var in locals) { if (!var.IsInScope(CurrentFrame.TargetAddress)) { continue; } EmonicInterpreter.localsOutput += var.Name; EmonicInterpreter.localsOutput += " "; string msg = context.Interpreter.Style.PrintVariable(var, CurrentFrame); context.Interpreter.Print(msg); } EmonicInterpreter.localsOutput = EmonicInterpreter.localsOutput.Trim(); EmonicInterpreter.localsSem.Release(); return(null); } catch { EmonicInterpreter.localsOutput = "--"; EmonicInterpreter.localsSem.Release(); throw; } }
public void AssertPrintRegex(Thread thread, DisplayFormat format, string expression, string exp_re) { string text = null; try { ScriptingContext context = GetContext(thread); object obj = EvaluateExpression(context, expression); text = context.FormatObject(obj, format); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.Fail("Failed to print expression `{0}': {1}", expression, ex); } Match match = Regex.Match(text, exp_re); if (!match.Success) { Assert.Fail("Expression `{0}' evaluated to `{1}', but expected `{2}'.", expression, text, exp_re); } }
ScriptingContext GetContext(Thread thread) { ScriptingContext context = new ScriptingContext(interpreter); context.CurrentThread = thread; context.CurrentFrame = thread.CurrentFrame; return(context); }
/// <summary> /// Handles the Execute command. /// </summary> private void HandleExecuteCommand(object sender, ExecutedRoutedEventArgs e) { ScriptingContext.VerifyCommand(CurrentCommand); var command = CurrentCommand; CurrentCommand = string.Empty; ScriptingContext.ExecuteCommand(command); History.Add(command); }
private void Init() { Result <string> scriptsPath = FileIO.SearchAFolderAboveTheCurrentDirectoryOfTheApplication(Settings.ScriptsPath_JsScripts); // find the folder with the scripts if (scriptsPath.IsFailure) { throw new InvalidOperationException("scripts folder not found"); } jsScriptingContext = ScriptingContext.ScriptingContextWithRealFs(scriptsPath.Value); }
private (string ScriptsPath, ScriptingContext JsScriptingContext) InitWithRealFs() { Result <string> scriptsPath = FileIO.SearchAFolderAboveTheCurrentDirectoryOfTheApplication(Scripting_TestSettings.ScriptsPath_JsScripts); // find the folder with the scripts if (scriptsPath.IsFailure) { throw new InvalidOperationException("scripts folder not found"); } //return (scriptsPath.Value, ScriptingContext.ScriptingContextWithInMemoryFs(InMemoryScripts.GetScripts())); return(scriptsPath.Value, ScriptingContext.ScriptingContextWithRealFs(scriptsPath.Value)); }
async Task IKustoManagementGateway.ExecuteCommandsAsync( IEnumerable <CommandBase> commands, CancellationToken ct) { if (commands.Any()) { _tracer.WriteLine(true, ".execute database script commands start"); var tracerTimer = new TracerTimer(_tracer); var scriptingContext = new ScriptingContext { CurrentDatabaseName = new EntityName(_database) }; var commandScripts = commands.Select(c => c.ToScript(scriptingContext)); var fullScript = ".execute database script with (ThrowOnErrors=true) <|" + Environment.NewLine + string.Join(Environment.NewLine + Environment.NewLine, commandScripts); var output = await ExecuteCommandAsync(fullScript, ct); _tracer.WriteLine(true, ".execute database script commands end"); tracerTimer.WriteTime(true, ".execute database script commands time"); var content = Select( output, r => new { Result = (string)r["Result"], Reason = (string)r["Reason"], CommandText = (string)r["CommandText"], OperationId = (Guid)r["OperationId"] }); var failedItems = content.Where(t => t.Result != "Completed"); if (failedItems.Any()) { var failedItem = failedItems.First(); var failedItemCommand = PackageString(failedItem.CommandText); var allCommands = string.Join( ", ", content.Select(i => $"({i.Result}: '{PackageString(i.CommandText)}')")); throw new InvalidOperationException( $"Command failed to execute with reason '{failedItem.Reason}'. " + $"Operation ID: {failedItem.OperationId}. " + $"Cluster URI: {_clusterUri}. " + $"Database: {_database}. " + $"Command: '{failedItemCommand}'. " + $"All commands: {allCommands}"); } } }
public static void UseInteractive(InteractionDef interaction) { var ui = FindObjectOfType <UIVisual>(); var character = ui.Character; var targetCtx = new ScriptingContext() { ProcessingEntity = character, Host = ((NetworkEntity)ui.Interactive).Id }; if (interaction.Predicate.Def == null || interaction.Predicate.Def.Check(targetCtx)) { ((IImpactedEntity)character).RunImpact(null, interaction.Impact.Def); } }
public void Jint_Scripting_InMemoryFiles_Test() { //Assert.Inconclusive(); return; ScriptingContext jsScriptingContext = ScriptingContext.ScriptingContextWithInMemoryFs(ES5_scripts_to_zip_plus_to_encode_in_Base64.GetScripts()); JsScriptRunner jsScriptRunner = JsScriptRunner.RunnerWithContext( JsScriptRunnerType.Jint, jsScriptingContext, Scripting_TestSettings.ScriptingContextName); jsScriptRunner.Run("var exports = {};"); // required by the row of 'main.js' ```Object.defineProperty(exports, "__esModule", { value: true });``` generated by TypeScript jsScriptRunner.Run(jsScriptingContext.ReadFile("./lib/myrequire.js")); // load a custom version of 'require' jsScriptRunner.Run(jsScriptingContext.ReadFile("main.js")); // execute script from virtual FS (would have been the same executing "./main.js") Assert.AreEqual("Hello World", jsScriptingContext.ReadFile("filename")); // test output of Js scripts }
private void Initialize() { if (_initialized) { return; } ScriptingContext = new ScriptingContext { SimSupportModules = GetRegisteredSimSupportModules(), HardwareSupportModules = GetRegisteredHardwareSupportModules() }; AddPerformanceMonitoringSignals(); InitializeMappings(); _initialized = true; }
protected override object DoExecute(ScriptingContext context) { Event handle; if (!address.IsNull) { handle = context.Interpreter.Session.InsertBreakpoint( context.CurrentThread, tgroup, address); context.Print("Breakpoint {0} at {1}", handle.Index, address); } else if (location != null) { // line breakpoints use this method! handle = context.Interpreter.Session.InsertBreakpoint( tgroup, location); context.Print("Breakpoint {0} at {1}", handle.Index, location.Name); } else { handle = context.Interpreter.Session.InsertBreakpoint( tgroup, type, Argument); context.Print("Breakpoint {0} at {1}", handle.Index, Argument); } if (!context.Interpreter.HasTarget) { EmonicInterpreter.breakpointNumber = handle.Index; EmonicInterpreter.breakpointSem.Release(); return(handle.Index); } try { handle.Activate(context.Interpreter.CurrentThread); } catch { if (!lazy) { EmonicInterpreter.breakpointNumber = -1; EmonicInterpreter.breakpointSem.Release(); throw; } } EmonicInterpreter.breakpointNumber = handle.Index; EmonicInterpreter.breakpointSem.Release(); return(handle.Index); }
protected override bool DoResolve(ScriptingContext context) { // try-catch: on exceptions, we must release the semaphore try { if (CurrentFrame.Method == null) { throw new ScriptingException( "Selected stack frame has no method."); } locals = CurrentFrame.Method.GetLocalVariables(context.CurrentThread); return(true); } catch { EmonicInterpreter.localsOutput = "--"; EmonicInterpreter.localsSem.Release(); throw; } }
protected override bool DoResolve(ScriptingContext context) { // catch exceptions and release the semaphore in case of one try { if (CurrentFrame.Method == null) { throw new ScriptingException( "Selected stack frame has no method."); } param_vars = CurrentFrame.Method.GetParameters(context.CurrentThread); return(true); } catch { EmonicInterpreter.paramsOutput = "--"; EmonicInterpreter.paramsSem.Release(); throw; } }
public object EvaluateExpression(Thread thread, string expression) { try { ScriptingContext context = GetContext(thread); object obj = EvaluateExpression(context, expression); if (obj == null) { Assert.Fail("Failed to evaluate expression `{0}'", expression); } return(obj); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.Fail("Failed to print expression `{0}': {1}", expression, ex); return(null); } }
public void Apply(ScriptingContext ctx) { var ae = ctx.ProcessingEntity.CurrentServer.GetGhost(ctx.Host) as IHasActionEngine; if (ae == null) { return; } else { var spell = ae.ActionEngine.GetSpell(InvokedSpell.Def); if (spell != null) { var pe = ctx.ProcessingEntity.CurrentServer.GetGhost(ctx.Host) as IPositionedEntity; (ae as IHasSpells).SpellsEngine.FireAndForgetCast(new SpellCast() { Def = spell, OwnerObject = ctx.Host, TargetEntity = ctx.Host, TargetPoint = pe?.Position ?? default });
protected override string Execute(ScriptingContext context, Expression expression, DisplayFormat format) { // try-catch block for whole method: if an exception occurs, we are able to // release the semaphore waiting for the command answer try { TargetType type = expression.EvaluateType(context); string fieldNames = ""; string fieldNamesStaticOnly = ""; if (type.Kind == TargetObjectKind.Class || type.Kind == TargetObjectKind.Struct) { TargetClassType stype = (TargetClassType)type; foreach (TargetFieldInfo field in stype.Fields) { fieldNames += field.Name; fieldNames += " "; if (field.IsStatic) { fieldNamesStaticOnly += field.Name; fieldNamesStaticOnly += " "; } } fieldNames = fieldNames.Trim(); fieldNamesStaticOnly = fieldNamesStaticOnly.Trim(); } string text = context.FormatType(type); context.Print(text); EmonicInterpreter.ptypeOutput = fieldNames; EmonicInterpreter.ptypeOutputStaticOnly = fieldNamesStaticOnly; EmonicInterpreter.ptypeSem.Release(); return(text); } catch { EmonicInterpreter.ptypeOutput = "--"; EmonicInterpreter.ptypeOutputStaticOnly = "--"; EmonicInterpreter.ptypeSem.Release(); throw; } }
public void AssertType(Thread thread, string expression, string exp_result) { string text = null; try { ScriptingContext context = GetContext(thread); TargetType type = EvaluateExpressionType(context, expression); text = context.FormatType(type); } catch (AssertionException) { throw; } catch (Exception ex) { Assert.Fail("Failed to evaluate type of expression `{0}': {1}", expression, ex); } if (text != exp_result) { Assert.Fail("Type of expression `{0}' is `{1}', but expected `{2}'.", expression, text, exp_result); } }
public void ClearScript_Scripting_RealFs_Test() { //Assert.Inconclusive(); return; Result <string> scriptsPath = FileIO.SearchAFolderAboveTheCurrentDirectoryOfTheApplication(Scripting_TestSettings.ScriptsPath_Tests); // find the folder with the scripts if (scriptsPath.IsFailure) { throw new InvalidOperationException("scripts folder not found"); } ScriptingContext jsScriptingContext = ScriptingContext.ScriptingContextWithRealFs(Path.Combine(scriptsPath.Value, Scripting_TestSettings.ScriptsPath_Tests_ES6)); JsScriptRunner jsScriptRunner = JsScriptRunner.RunnerWithContext( JsScriptRunnerType.ClearScript, jsScriptingContext, Scripting_TestSettings.ScriptingContextName); jsScriptRunner.Run("var exports = {};"); // required by the row of 'main.js' ```Object.defineProperty(exports, "__esModule", { value: true });``` generated by TypeScript jsScriptRunner.Run(jsScriptingContext.ReadFile("./lib/myrequire.js")); // load a custom version of 'require' jsScriptRunner.Run(jsScriptingContext.ReadFile("main.js")); // execute script from virtual FS (would have been the same executing "./main.js") Assert.AreEqual("Hello World", jsScriptingContext.ReadFile("filename")); // test output of Js scripts }
public ActionResult Run(string command) { var context = new ScriptingContext(); var roslynEngine = new ScriptEngine(); Roslyn.Scripting.Session session = roslynEngine.CreateSession(context); session.AddReference(context.GetType().Assembly); session.AddReference("System.Web"); session.AddReference("System"); session.AddReference("System.Core"); session.AddReference("System.Collections"); session.AddReference("System.Linq"); session.AddReference("System.Xml"); session.AddReference("System.Xml.Linq"); session.ImportNamespace("System"); session.ImportNamespace("System.IO"); session.ImportNamespace("System.Linq"); session.ImportNamespace("System.Xml.Linq"); var res = session.Execute(command); return(View(res)); }
protected override string Execute(ScriptingContext context, Expression expression, DisplayFormat format) { try { if (expression is TypeExpression) { throw new ScriptingException( "`{0}' is a type, not a variable.", expression.Name); } object retval = expression.Evaluate(context); EmonicInterpreter.printData output = new EmonicInterpreter.printData(); output.type = ""; output.varValue = ""; output.varNames = ""; if (retval != null) { output.type = ((TargetObject)retval).TypeName; if (output.type == null) { output.type = ""; } switch (((TargetObject)retval).Kind) { case TargetObjectKind.Fundamental: // we send the value of the fundamental type TargetFundamentalObject tfo = retval as TargetFundamentalObject; if (tfo == null) { // element is "null" output.varValue = "<null>"; break; } output.varValue = tfo.GetObject(context.CurrentThread).ToString(); if (output.varValue == null) { output.varValue = ""; } break; case TargetObjectKind.Array: // we send back the number of array elements TargetArrayObject tao = retval as TargetArrayObject; if (tao == null) { // element is "null" output.varValue = "<null>"; break; } int lower = tao.GetLowerBound(context.CurrentThread, 0); int upper = tao.GetUpperBound(context.CurrentThread, 0); output.varNames = (upper - lower).ToString(); break; // same for struct and class case TargetObjectKind.Struct: case TargetObjectKind.Class: // we send back the member's names // NOTE! we also show static and constant fields TargetObject obj = retval as TargetObject; if (obj.HasAddress && obj.GetAddress(context.CurrentThread).IsNull) { output.varValue = "<null>"; break; } Mono.Debugger.Thread thread = context.CurrentThread; TargetClass tc = ((TargetClassObject)retval).Type.GetClass(thread); if (tc == null) { break; } TargetFieldInfo[] tfi = tc.GetFields(thread); if (tfi == null) { break; } output.varNames = ""; for (int i = 0; i < tfi.Length; i++) { if (tfi[i].IsStatic) // do not show static fields, they're not accessible via the instance! { continue; } output.varNames += tfi[i].Name; output.varNames += " "; } output.varNames = output.varNames.Trim(); break; case TargetObjectKind.Object: case TargetObjectKind.Pointer: case TargetObjectKind.Unknown: case TargetObjectKind.Function: case TargetObjectKind.Alias: case TargetObjectKind.Enum: context.Print("ERROR: Print Command will return no values because of an implementation error"); break; } } string text = context.FormatObject(retval, format); context.Print(text); EmonicInterpreter.printOutput = output; EmonicInterpreter.printSem.Release(); return(text); } catch { EmonicInterpreter.printData output = new EmonicInterpreter.printData(); output.type = ""; output.varValue = ""; output.varNames = ""; EmonicInterpreter.printOutput = output; EmonicInterpreter.printSem.Release(); throw; } }
// copied from the PrintCommand class - we must be able to catch Exceptions here protected override bool DoResolve(ScriptingContext context) { // big try-catch block: we are able to react to Exceptions this way // and release the semaphore waiting for the command answer try { if (Argument.StartsWith("/")) { int pos = Argument.IndexOfAny(new char[] { ' ', '\t' }); string fstring = Argument.Substring(1, pos - 1); string arg = Argument.Substring(pos + 1); switch (fstring) { case "o": case "object": format = DisplayFormat.Object; break; case "a": case "address": format = DisplayFormat.Address; break; case "x": case "hex": format = DisplayFormat.HexaDecimal; break; case "default": format = DisplayFormat.Default; break; default: throw new ScriptingException( "Unknown format: `{0}'", fstring); } expression = DoParseExpression(context, arg); } else { expression = ParseExpression(context); } if (expression == null) { return(false); } if (this is PrintTypeCommand) { Expression resolved = expression.TryResolveType(context); if (resolved != null) { expression = resolved; return(true); } } expression = expression.Resolve(context); return(expression != null); } catch { EmonicInterpreter.ptypeOutput = "--"; EmonicInterpreter.ptypeOutputStaticOnly = "--"; EmonicInterpreter.ptypeSem.Release(); throw; } }
// copied from PrintCommand class protected override object DoExecute(ScriptingContext context) { return(Execute(context, expression, format)); }
protected override bool DoResolve(ScriptingContext context) { // do not query "yes or no?", simply quit return(true); }
protected override bool DoResolve(ScriptingContext context) { // set whole method in a try-catch block: if anything goes wrong, an invalid breakpoint // number is set and the semaphore is released. try { if (global) { if (local) { throw new ScriptingException( "Cannot use both -local and -global."); } if (Group != null) { throw new ScriptingException( "Cannot use both -group and -global."); } tgroup = ThreadGroup.Global; } else if (local) { if (Group != null) { throw new ScriptingException( "Cannot use both -group and -local."); } tgroup = context.Interpreter.GetThreadGroup(Group, false); } else if (Group != null) { tgroup = context.Interpreter.GetThreadGroup(Group, false); } else { tgroup = ThreadGroup.Global; } if (context.Interpreter.HasTarget) { context.CurrentProcess = context.Interpreter.GetProcess(p_index); context.CurrentThread = context.Interpreter.GetThread(t_index); Mono.Debugger.Thread thread = context.CurrentThread; if (!thread.IsStopped) { throw new Mono.Debugger.TargetException(TargetError.NotStopped); } Backtrace backtrace = thread.GetBacktrace(); StackFrame frame; if (f_index == -1) { frame = backtrace.CurrentFrame; } else { if (f_index >= backtrace.Count) { throw new ScriptingException( "No such frame: {0}", f_index); } frame = backtrace [f_index]; } context.CurrentFrame = frame; if (ExpressionParser.ParseLocation( thread, thread.CurrentFrame, Argument, out location)) { return(true); } } if (Argument.IndexOf(':') > 0) { return(true); } try { UInt32.Parse(Argument); return(true); } catch { } Expression expr = context.Interpreter.ExpressionParser.Parse(Argument); if (expr == null) { throw new ScriptingException("Cannot resolve expression `{0}'.", Argument); } if (expr is PointerExpression) { address = ((PointerExpression)expr).EvaluateAddress(context); return(true); } if (!context.Interpreter.HasTarget) { return(true); } MethodExpression mexpr; try { mexpr = expr.ResolveMethod(context, type); } catch { if (lazy) { return(true); } throw new ScriptingException("No such method: `{0}'.", Argument); } if (mexpr != null) { location = mexpr.EvaluateSource(context); } else { location = context.FindMethod(Argument); } if (lazy) { return(true); } if (location == null) { throw new ScriptingException("No such method: `{0}'.", Argument); } return(true); } catch { EmonicInterpreter.breakpointNumber = -1; EmonicInterpreter.breakpointSem.Release(); throw; } }
// copied that from PrintCommand class - we need that here because we need // to know if any exceptions in this method are raised protected override bool DoResolve(ScriptingContext context) { // whole method in a try-catch block - if any exceptions occur, we are able to generate // an invalid web service response and release the semaphore try { if (Argument.StartsWith("/")) { int pos = Argument.IndexOfAny(new char[] { ' ', '\t' }); string fstring = Argument.Substring(1, pos - 1); string arg = Argument.Substring(pos + 1); switch (fstring) { case "o": case "object": format = DisplayFormat.Object; break; case "a": case "address": format = DisplayFormat.Address; break; case "x": case "hex": format = DisplayFormat.HexaDecimal; break; case "default": format = DisplayFormat.Default; break; default: throw new ScriptingException( "Unknown format: `{0}'", fstring); } expression = DoParseExpression(context, arg); } else { expression = ParseExpression(context); } if (expression == null) { return(false); } expression = expression.Resolve(context); return(expression != null); } catch { EmonicInterpreter.printData output = new EmonicInterpreter.printData(); output.type = ""; output.varValue = ""; output.varNames = ""; EmonicInterpreter.printOutput = output; EmonicInterpreter.printSem.Release(); throw; } }
protected override object DoExecute(ScriptingContext context) { int current_id = -1; if (context.Interpreter.HasCurrentThread) { current_id = context.Interpreter.CurrentThread.ID; } bool printed_something = false; Process[] processes = context.Interpreter.Processes; for (int i = 0; i < processes.Length; i++) { context.Print("Process {0}:", context.Interpreter.PrintProcess(processes[i])); Mono.Debugger.Thread[] threads = processes[i].GetThreads(); for (int j = 0; j < threads.Length; j++) { string prefix = threads[j].ID == current_id ? "(*)" : " "; context.Print("{0} {1} ({2}:{3:x}) {4}", prefix, threads[j], threads[j].PID, threads[j].TID, threads[j].State); printed_something = true; EmonicInterpreter.threadData td = new EmonicInterpreter.threadData(); td.processNumber = processes[i].ID; td.PID = processes[i].MainThread.PID; td.processCmdLine = context.Interpreter.PrintCommandLineArgs(processes[i]); td.threadNumber = threads[j].ID; if ((threads[j].ThreadFlags & Mono.Debugger.Thread.Flags.Daemon) != 0) { td.daemonThread = true; } else { td.daemonThread = false; } td.threadState = threads[j].State != Mono.Debugger.TargetState.Stopped; td.currentThread = threads[j].ID == current_id; td.TID = threads[j].PID; // we take the PID of the thread here, not really the TID td.moreData = j + 1 < threads.Length || i + 1 < processes.Length; EmonicInterpreter.threadList.Add(td); } } if (!printed_something) { context.Print("No target."); // generate an invalid response EmonicInterpreter.threadData td = new EmonicInterpreter.threadData(); td.processNumber = -1; td.PID = -1; td.processCmdLine = ""; td.threadNumber = -1; td.daemonThread = false; td.threadState = false; td.currentThread = false; td.TID = -1; td.moreData = false; EmonicInterpreter.threadList.Add(td); } return(null); }
protected override object DoExecute(ScriptingContext context) { Backtrace backtrace = null; if ((mode == Backtrace.Mode.Default) && (max_frames == -1)) { backtrace = CurrentThread.CurrentBacktrace; } if (backtrace == null) { backtrace = CurrentThread.GetBacktrace(mode, max_frames); } for (int i = 0; i < backtrace.Count; i++) { string prefix = i == backtrace.CurrentFrameIndex ? "(*)" : " "; context.Print("{0} {1}", prefix, backtrace [i]); EmonicInterpreter.backtraceData bt = new EmonicInterpreter.backtraceData(); bt.frameNumber = backtrace[i].Level; bt.currentFrame = i == backtrace.CurrentFrameIndex; if (backtrace[i].Method != null) { bt.method = backtrace[i].Method.Name; if (bt.method == null) { bt.method = ""; } } else { if (backtrace[i].Name == null) { bt.method = ""; } else { bt.method = backtrace[i].Name.ToString(); if (bt.method == null) { bt.method = ""; } } } if (backtrace[i].SourceAddress != null && backtrace[i].SourceAddress.SourceFile != null) { bt.file = backtrace[i].SourceAddress.SourceFile.FileName; } else { bt.file = ""; } if (backtrace[i].SourceAddress != null) { bt.lineNumber = backtrace[i].SourceAddress.Row; } else { bt.lineNumber = -1; } if (i + 1 < backtrace.Count) { bt.moreData = true; } else { bt.moreData = false; } EmonicInterpreter.backtraceList.Add(bt); } return(backtrace); }