Bug 39157 - Format exception on deserialising /date()/
Summary: Format exception on deserialising /date()/
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: 4.2.0 (C6)
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-02-26 12:17 UTC by Peter Hagen
Modified: 2016-02-26 12:17 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Peter Hagen 2016-02-26 12:17:52 UTC
Mono 4.2.2.30 throws an exception when deserialising a json string with a "/date(...)/" value in it. .Net doesn't do this. I would except the serialiser to skip this value. 

Way to reproduce in csharp shell:

LoadAssembly("System.Web.Extensions.dll")     
var ser = new System.Web.Script.Serialization.JavaScriptSerializer();
ser.DeserializeObject ("{\"Id\":33,\"Label\":\"Fire Safety Manager\",\"FkArticleGroup\":\"11\",\"FkArticleType\":\"1\",\"FkBvoLocation\":\"2\",\"SubscriptionsMax\":\"16\",\"NrOfDays\":6,\"DateCreated\":\"/Date(1452085898000+0100)/\",\"DateModified\":\"/Date(1454506875000+0100)/\",\"SesReq\":\"h7GkDUbDkxhWQ7lX9qAl5dsolDj9b5rYvEfJToqlNgw1\",\"FkCourseDefinition\":\"33\",\"FkBvoCourseDaypart\":\"4\",\"IncludesExam\":null,\"ManualBookedUp\":null,\"Inactive\":null}"); 

System.FormatException: Input string was not in a correct format.
  at System.Number.StringToNumber (System.String str, NumberStyles options, System.NumberBuffer& number, System.Globalization.NumberFormatInfo info, Boolean parseDecimal) <0x7f189b225aa0 + 0x000e1> in <filename unknown>:0 
  at System.Number.ParseInt64 (System.String value, NumberStyles options, System.Globalization.NumberFormatInfo numfmt) <0x7f189b2249c0 + 0x00096> in <filename unknown>:0 
  at System.Int64.Parse (System.String s, IFormatProvider provider) <0x7f189b205f40 + 0x00025> in <filename unknown>:0 
  at System.Convert.ToInt64 (System.String value) <0x7f189b1a4540 + 0x00024> in <filename unknown>:0 
  at System.Web.Script.Serialization.JsonDeserializer.ParseBuffer (System.Object& result) <0x41353da0 + 0x0067e> in <filename unknown>:0 
  at System.Web.Script.Serialization.JsonDeserializer.ProcessCharacter (Char ch) <0x41352c90 + 0x00687> in <filename unknown>:0 
  at System.Web.Script.Serialization.JsonDeserializer.Deserialize (System.IO.TextReader input) <0x41352a20 + 0x000d3> in <filename unknown>:0 
  at System.Web.Script.Serialization.Json.Deserialize (System.IO.TextReader input, System.Web.Script.Serialization.JavaScriptSerializer jss) <0x413524b0 + 0x0005b> in <filename unknown>:0 
  at System.Web.Script.Serialization.Json.Deserialize (System.String input, System.Web.Script.Serialization.JavaScriptSerializer jss) <0x413523b0 + 0x0004f> in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObjectInternal (System.String input) <0x41352380 + 0x0001b> in <filename unknown>:0 
  at System.Web.Script.Serialization.JavaScriptSerializer.DeserializeObject (System.String input) <0x413521e0 + 0x0002f> in <filename unknown>:0 
  at <InteractiveExpressionClass>.Host (System.Object& $retval) <0x41352150 + 0x00027> in <filename unknown>:0 
  at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result, System.Boolean& result_set) <0x4129ad30 + 0x000dd> in <filename unknown>:0 
  at Mono.CSharpShell.Evaluate (System.String input) <0x4129ac30 + 0x00053> in <filename unknown>:0

Note You need to log in before you can comment on or make changes to this bug.