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)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 39157 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

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