JavaScriptSerializer and monodevelop
Asked Answered
A

2

3

Im reading this book but I JavaScriptSerializer from the System.Web.Script.Serialization namespace because it seems to be unavailable?

Absent answered 18/8, 2010 at 20:38 Comment(0)
R
1

Download source here and add as existing project. Then add as reference:

http://www.bloxify.com/post/MonoTouch-Easy-JSON-Library.aspx

Edit:

You may also find that the monotouch linker is pretty aggressive. I would have code work fine in the simulator but crash in the device with method missing exceptions. Add a method somewhere in your app (you dont have to call it) like so:

    public void FixMonoTouchErrors()
    {
        var gc = new System.ComponentModel.GuidConverter();
        var sc = new System.ComponentModel.StringConverter();
        var dc = new System.ComponentModel.DateTimeConverter();
        var cc = new System.ComponentModel.CharConverter();
        var sh = new System.ComponentModel.Int16Converter();
        var sh1 = new System.ComponentModel.Int32Converter();
        var sh2 = new System.ComponentModel.Int64Converter();
        var dec = new System.ComponentModel.DecimalConverter();
        var nc0 = new System.ComponentModel.NullableConverter(typeof(Int16?));
        var nc1 = new System.ComponentModel.NullableConverter(typeof(Int32?));
        var nc2 = new System.ComponentModel.NullableConverter(typeof(Int64?));
        var nc3 = new System.ComponentModel.NullableConverter(typeof(decimal?));
        var nc4 = new System.ComponentModel.NullableConverter(typeof(DateTime?));
    }
Retake answered 18/8, 2010 at 23:15 Comment(4)
Okay, thanks! Yesterday I used System.Runtime.Serialization.Json.DataContractJsonSerializer instead but thanks anyway,Absent
I am wondering what API do you call that causes this crash? We can make the above happen automatically if you tell us what triggered it.Kare
I am wondering what API do you call that causes this crash? We can make the above happen automatically if you tell us what triggered it.Kare
I believe for me it was the code posted on the (now dead) link wrapping NewtonSoft JSON.NET to fit the JavaScriptSerializer APIs.Retake
A
7

I know this a really old post but by chance someone stumbles upon this like I have, System.Web.Script.Serialization is available in System.Web.Extensions.

Arva answered 19/1, 2012 at 21:38 Comment(0)
R
1

Download source here and add as existing project. Then add as reference:

http://www.bloxify.com/post/MonoTouch-Easy-JSON-Library.aspx

Edit:

You may also find that the monotouch linker is pretty aggressive. I would have code work fine in the simulator but crash in the device with method missing exceptions. Add a method somewhere in your app (you dont have to call it) like so:

    public void FixMonoTouchErrors()
    {
        var gc = new System.ComponentModel.GuidConverter();
        var sc = new System.ComponentModel.StringConverter();
        var dc = new System.ComponentModel.DateTimeConverter();
        var cc = new System.ComponentModel.CharConverter();
        var sh = new System.ComponentModel.Int16Converter();
        var sh1 = new System.ComponentModel.Int32Converter();
        var sh2 = new System.ComponentModel.Int64Converter();
        var dec = new System.ComponentModel.DecimalConverter();
        var nc0 = new System.ComponentModel.NullableConverter(typeof(Int16?));
        var nc1 = new System.ComponentModel.NullableConverter(typeof(Int32?));
        var nc2 = new System.ComponentModel.NullableConverter(typeof(Int64?));
        var nc3 = new System.ComponentModel.NullableConverter(typeof(decimal?));
        var nc4 = new System.ComponentModel.NullableConverter(typeof(DateTime?));
    }
Retake answered 18/8, 2010 at 23:15 Comment(4)
Okay, thanks! Yesterday I used System.Runtime.Serialization.Json.DataContractJsonSerializer instead but thanks anyway,Absent
I am wondering what API do you call that causes this crash? We can make the above happen automatically if you tell us what triggered it.Kare
I am wondering what API do you call that causes this crash? We can make the above happen automatically if you tell us what triggered it.Kare
I believe for me it was the code posted on the (now dead) link wrapping NewtonSoft JSON.NET to fit the JavaScriptSerializer APIs.Retake

© 2022 - 2024 — McMap. All rights reserved.