NickCraver / StackExchange.Exceptional

Error handler used for the Stack Exchange network
https://nickcraver.com/StackExchange.Exceptional/
Apache License 2.0
863 stars 171 forks source link

Make the conversation from and to json extendable. #55

Closed Tasteful closed 9 years ago

Tasteful commented 10 years ago

In one of my costomers environemnt I got the following error/message when the object should be stored down to SqlErrorStore

Error log is in failure mode, 1 entry queued to log.
Last Logging Exception: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

To be able to configure the maxJsonLength property on the JavaScriptSerializer the Error.cs need to be extendable to allow configuration of the converter.

With the configurable Func-properties it will be possible to change the json serialization to ex Json.net without to create a direct dependency to the thirdparty assembly.

NickCraver commented 10 years ago

I'm not sure I support this level of indirection as it restricts the flexibility much more for the implementation down the road. Are you not adjusting the JSON length in your web.config already? Like this:

<configuration> 
 <system.web.extensions>
   <scripting>
     <webServices>
       <jsonSerialization maxJsonLength="50000000"/>
     </webServices>
   </scripting>
 </system.web.extensions>
</configuration> 

That's the proper fix here, and what we do on Stack Overflow for many other reasons as well. That being said, that's still a decent sized error, I'd look if there's either an enormous stack which needs resolving or a large form field you'd rather ignore.

As an aside: please look at tabs vs. spaces when contributing to projects please! You can click the changes tab on this pull request to see the inconsistencies I mean.