support Silverlight 4 beta?

Jan 1, 2010 at 7:17 PM

I need to customize the json format and MS's DataContractJsonSerializer has very little leeway for customization.  And I found Json.NET which offers great deal of customization. However, I am trying to use it on Silverlight 4.0 Beta. I got the following exception. Can someone shed some light as to whether it is specific to Silverlight 4.0 beta?

Thanks a lot!


Message: Unhandled Error in Silverlight 2 Application Attempt by security transparent method 'Newtonsoft.Json.Utilities.LateBoundDelegateFactory.CreateDynamicMethod(System.String, System.Type, System.Type[], System.Type)' to access security critical method 'System.Reflection.Emit.DynamicMethod..ctor(System.String, System.Type, System.Type[], System.Type, Boolean)' failed.   at Newtonsoft.Json.Utilities.LateBoundDelegateFactory.CreateDynamicMethod(String name, Type returnType, Type[] parameterTypes, Type owner)
   at Newtonsoft.Json.Utilities.LateBoundDelegateFactory.CreateDefaultConstructor(Type type)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract(JsonContract contract)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type objectType)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)
   at Newtonsoft.Json.Utilities.ThreadSafeStore`2.AddValue(TKey key)
   at Newtonsoft.Json.Utilities.ThreadSafeStore`2.Get(TKey key)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.GetContractSafe(Object value)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value)
   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value)
   at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.SerializeObject(Object value)
   at GAE_JSON.MainPage.testPost()
   at GAE_JSON.MainPage.Button_Click(Object sender, RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

Coordinator
Jan 1, 2010 at 11:00 PM

Hi

I've fixed that bug and updated the latest release on the site.

http://json.codeplex.com/Release/ProjectReleases.aspx

Jan 2, 2010 at 12:01 AM

James,

Thanks a lot! It works great.