From 0e4c8b8177746dd0bebf2fabda6cde716d77fe40 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Thu, 1 May 2014 21:29:04 +0200 Subject: [PATCH] Fix escaping of char literals in debugger output. --- .../NRefactory/ExpressionEvaluationVisitor.cs | 6 +----- .../OutputVisitor/TextWriterOutputFormatter.cs | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs b/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs index c93000ea4b..81dc11623e 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs @@ -490,11 +490,7 @@ namespace Debugger.AddIn } sb.Append("}"); return sb.ToString(); - } else if (val.Type.IsKnownType(KnownTypeCode.Char)) { - return "'" + TextWriterTokenWriter.ConvertChar((char)val.PrimitiveValue) + "'"; - } else if (val.Type.IsKnownType(KnownTypeCode.String)) { - return "\"" + TextWriterTokenWriter.ConvertString((string)val.PrimitiveValue) + "\""; - } else if (val.Type.IsPrimitiveType()) { + } else if (val.Type.IsKnownType(KnownTypeCode.String) || val.Type.IsPrimitiveType()) { return TextWriterTokenWriter.PrintPrimitiveValue(val.PrimitiveValue); } else { return val.InvokeToString(evalThread); diff --git a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/TextWriterOutputFormatter.cs b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/TextWriterOutputFormatter.cs index 67c93cdaed..bb9db71277 100644 --- a/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/TextWriterOutputFormatter.cs +++ b/src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/TextWriterOutputFormatter.cs @@ -333,7 +333,7 @@ namespace ICSharpCode.NRefactory.CSharp /// Gets the escape sequence for the specified character. /// /// This method does not convert ' or ". - public static string ConvertChar(char ch) + static string ConvertChar(char ch) { switch (ch) { case '\\':