This project has moved and is read-only. For the latest updates, please go here.

Json.Compact unhandled exception

Jun 17, 2010 at 6:32 PM
Hi, I have a C# app targetted at a Windows CE 6.0 R2 platform. It uses your JSON to serialise and deserialise data for sending up to a server. Every now and again the application crashes. I just managed to read the popup dialogue box and it tells me that the crash is from within the JsonSerializer. It looks like the serializer is calling some unmanaged code ??. MethodBase.Invoke ??? Anyway in here it crashes BYPASSING all of my exception handler code - which is a REAL pain to me, as my app is unmanned - ie NO USER :-O. It throws up an unhandled exception in a dialogue box and my app (or the thread which failed) halts :-((. The Json.Compact dll tells me it is Version My guess is that its data dependent, as the thread I just caught the error in polls every 5 minutes for data from an external piece of equipment, which may of course be returning bad data. Having said that - my exception handlers SHOULD be catching these :-O. Any thoughts would be MUCH appreciated. Regards Graham
Jun 17, 2010 at 11:47 PM

There is no unmanaged code in Json.NET - MethodBase.Invoke would be from Json.NET using reflection to get or set properties on your class. I don't know why it would skip exception handlers, Json.NET throws regular exceptions when it encounters a problem.

If you aren't able to get automatic serialization working there is always the option to use LINQ to JSON to manually convert objects to JSON and back again.

Jun 18, 2010 at 8:19 AM


Thanks for this feedback. Hmmmm if there is no unmanaged code then I am at a loss to understand why I am getting exceptions thrown which are not being caught by the framework :-((.

I can't see how I can add an image to this forum, so have put a transcript of the crash here :

Its a jpg as I had to manually copy the error report from the VERY small dialog box presented by Windows CE - and forgot to save the text file :-O - I did print it, so scanned it to this jpg as above.

Maybe this will give a clue as to why the JSON code crashed outside of the frameworks exception handlers.

Is Linq to Json supported on the compact platform ??

Please remember that this is a application...

Many thanks




Jun 19, 2010 at 3:41 PM