private async void ExecuteExpression(string code) { if (string.IsNullOrEmpty(code)) { return; } AddHistoricalCode(); var ast = ParseRetExpression(code); if (ast == null) { return; } try { try { Interpreter.ResetState(); Interpreter.TakeOwnership(); #if APHID_FRAME_ADD_DATA || APHID_FRAME_CATCH_POP try { #endif Interpreter.Interpret(ast); #if APHID_FRAME_ADD_DATA || APHID_FRAME_CATCH_POP } #endif #if APHID_FRAME_ADD_DATA || APHID_FRAME_CATCH_POP #if APHID_FRAME_ADD_DATA catch (Exception e) #else catch #endif { if (e.Source != AphidName.DebugInterpreter) { e.Source = AphidName.DebugInterpreter; #if APHID_FRAME_CATCH_POP Interpreter.PopQueuedFrames(); #endif #if APHID_FRAME_ADD_DATA e.Data.Add(AphidName.Interpreter, Interpreter); e.Data.Add(AphidName.FramesKey, Interpreter.GetRawStackTrace()); #endif } throw; } #endif } catch (AphidRuntimeException ex) { CodeViewer.AppendException(code, "Runtime error", ex, Interpreter); return; } catch (AphidParserException ex) { CodeViewer.AppendParserException(code, ex); return; } catch (Exception ex) { CodeViewer.AppendException(code, ".NET Runtime error", ex, Interpreter); return; } var serialized = SerializingFormatter .CreateSerializer(Interpreter) .Serialize(Interpreter.GetReturnValue()); await WaitDumpTasksAsync(); await CodeViewer.Async(() => CodeViewer.AppendColoredOutput( Highlight(code), Highlight(serialized))); } finally { UpdateVariables(); await ExecuteWatchExpressionsAsync(); } }