Compact Framework MissingMethodException

Feb 24, 2011 at 2:14 PM

I'm using JSON.net for a project for Windows Mobile 6.5 with compact framework 3.5 in combination with JSON.net 3.5 release 8 (the compact framework DLL, doublechecked).

I'm trying to write some JSON string by using a stringbuilder in combination with a stringwriter and a JsonTextWriter:

 

 StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            using (JsonWriter jsonWriter = new JsonTextWriter(sw))
            {
                jsonWriter.Formatting = Formatting.Indented;
                jsonWriter.WriteStartObject();
                jsonWriter.WritePropertyName("ids");
                jsonWriter.WriteStartArray();
                foreach (String id in orders)
                {
                    jsonWriter.WriteValue(id);
                }
                jsonWriter.WriteEndArray();
                jsonWriter.WriteEndObject();
            }

 

This compiles ok, but when run on the PDA or in the emulator it throws a MissingMethodException on the line jsonWriter.WritePropertyName("ids");

Error message is: Method not found: get_NewLine System.Environment.

What am I doing wrong?

 

Kind regards,

 

Michael

 

May 8, 2013 at 9:16 PM
Edited May 8, 2013 at 9:17 PM
I'm having a similar problem to this (same exception, same error message). Can you please post your solution?

I realize that this thread is really old, but this is the only instance that Google could find of someone having a similar problem.