From c217961f81ae5c6d634a6d87d20199f7d5084934 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 26 Apr 2016 16:28:46 -0700 Subject: [PATCH] Fix Debugger display of JS strings that contain Date strings Addresses #106. Json.net will automatically try to parse strings that look like date strings. If one of these is recieved as the value in a Node debug message, we end up displaying the wrong value in the debugger. Fix, make sure we always use DateTimeParse.None when dealing with messages from the debugger. If we do need to parse a date string, we should handle those cases explicitly. closes #106 --- .../Product/Nodejs/Debugger/Communication/DebuggerClient.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Nodejs/Product/Nodejs/Debugger/Communication/DebuggerClient.cs b/Nodejs/Product/Nodejs/Debugger/Communication/DebuggerClient.cs index 72c8791cc..0a8293abe 100644 --- a/Nodejs/Product/Nodejs/Debugger/Communication/DebuggerClient.cs +++ b/Nodejs/Product/Nodejs/Debugger/Communication/DebuggerClient.cs @@ -33,6 +33,10 @@ sealed class DebuggerClient : IDebuggerClient { private ConcurrentDictionary> _messages = new ConcurrentDictionary>(); + private readonly static Newtonsoft.Json.JsonSerializerSettings jsonSettings = new Newtonsoft.Json.JsonSerializerSettings() { + DateParseHandling = Newtonsoft.Json.DateParseHandling.None + }; + public DebuggerClient(IDebuggerConnection connection) { Utilities.ArgumentNotNull("connection", connection); @@ -116,7 +120,7 @@ private void OnConnectionClosed(object sender, EventArgs e) { /// Sender. /// Event arguments. private void OnOutputMessage(object sender, MessageEventArgs args) { - JObject message = JObject.Parse(args.Message); + var message = Newtonsoft.Json.JsonConvert.DeserializeObject(args.Message, jsonSettings); var messageType = (string)message["type"]; switch (messageType) {