This project has moved. For the latest updates, please go here.

Deserialize<T> fails on Windows Phone 7 when T is not public ?

Jan 25, 2011 at 7:24 AM

I've the following class

class MyResponse
    [JsonProperty(PropertyName = "latest_article")]
    public Article LatestArticle { get; private set; }

And I use this code for deserialization:

var serializer = new Newtonsoft.Json.JsonSerializer();

using (var stringReader = new StringReader(content))
    using (var jsonTextReader = new JsonTextReader(stringReader))
        var x = serializer.Deserialize<T>(jsonTextReader);

Deserialize<T> fails with this exception: Attempt to access the method failed:MyResponse..ctor() ?

When using the same code in "C# .net 4.0 Client Profile" or "Full Profile", it just works. (I did not yet test Silverlight 4.)

Any ideas ?