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

Error when using JSON.NET, only in a WP7 project

Jan 28, 2012 at 3:11 PM

Here is some code that only fails (it compiles) when used in a WP7 project.

using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json.Linq;
using Test.Models;
using Newtonsoft.Json;


var tree = JObject.Parse(Json);

var temp = 
   from t in tree.Root["dates"].Children()
   select new Schedule {DateString = (string) t["date_string"]};


It is a WP7.1 project and the JSON.NET dll I am using is:

Here is the exception I find inside temp:

    'System.Collections.Generic.IEnumerable<Test.Models.Schedule>' does not contain a definition for 'System' and no extension method 'System' accepting a first argument of type 'System.Collections.Generic.IEnumerable<Test.Models.Schedule>' could be found (are you missing a using directive or an assembly reference?)

The "var tree = JObject.Parse(Json);" line parses the json string and builds the tree with no problems.

The exact code runs perfectly in a Monodroid and C# library project (with appropriate JSON.NET builds).

Any ideas?