We’ve seen an issue where were occasionally get “Occasional exception with JSON JavaScriptSerializer “The length of the string exceeds [maxJsonLength]”
We’ve changed Miniprofiler.Settings.maxJsonLength but we can see in the code that setting is not always referred to and therefore we still get the error.
I can see that “StackExchange.Profiling/MiniProfiler.cs” does this:-
private static JavaScriptSerializer GetJsonSerializer()
362 return new JavaScriptSerializer { MaxJsonLength = Settings.MaxJsonResponseSize };
BUT StackExchange.Profiling/Helpers/ExtensionMethods.cs does this:-
73 return o == null ? null : new JavaScriptSerializer().Serialize(o);
and
83 return s.HasValue() ? new JavaScriptSerializer().Deserialize<T>(s) : null;
I think it should really respect MaxJsonLength = Settings.MaxJsonResponseSize in both cases.
Anyone wish to comment?
James