从silverlight canvas应用程序调用FacebookClient.PostAsync会生成MethodAccessException

时间:2011-05-09 22:00:10

标签: silverlight-4.0 facebook-c#-sdk

我从一个Silverlight应用程序中调用它:

// docs at: http://developers.facebook.com/docs/reference/api/post
            var client = new FacebookClient(_token);
            dynamic parameters = new ExpandoObject();
            parameters.message = title;
            parameters.link = linkUrl;
            parameters.picture = imageUrl;
            parameters.name = name;
            parameters.caption = promptTitle;
            parameters.description = description;
            parameters.privacy = new
            {
                value = "ALL_FRIENDS",
            };
            client.PostAsync("me/feed", parameters);

这会产生以下错误: 尝试使用安全透明方法'SimpleJson.Reflection.CacheResolver.CreateDynamicMethod(System.String,System.Type,System.Type [],System.Type)'来访问安全关键方法'System.Reflection.Emit.DynamicMethod..ctor( System.String,System.Type,System.Type [],System.Type,Boolean)'失败。

- 更多: -

{System.MethodAccessException:安全透明方法'SimpleJson.Reflection.CacheResolver.CreateDynamicMethod(System.String,System.Type,System.Type [],System.Type)'尝试访问安全关键方法'System.Reflection .Emit.DynamicMethod..ctor(System.String,System.Type,System.Type [],System.Type,Boolean)'失败。    at SimpleJson.Reflection.CacheResolver.CreateDynamicMethod(String name,Type returnType,Type [] parameterTypes,Type owner)    在SimpleJson.Reflection.CacheResolver.CreateGetHandler(PropertyInfo propertyInfo)    在SimpleJson.Reflection.CacheResolver.MemberMap..ctor(PropertyInfo propertyInfo)    在SimpleJson.PocoJsonSerializerStrategy.BuildMap(Type type,SafeDictionary 2 memberMaps) at SimpleJson.DataContractJsonSerializerStrategy.BuildMap(Type type, SafeDictionary 2 map)    在SimpleJson.Reflection.CacheResolver.LoadMaps(类型类型)    在SimpleJson.PocoJsonSerializerStrategy.TrySerializeUnknownTypes(对象输入,对象和输出)    在SimpleJson.PocoJsonSerializerStrategy.SerializeNonPrimitiveObject(对象输入,对象和输出)    在SimpleJson.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy,Object value,StringBuilder builder)    在SimpleJson.SimpleJson.SerializeObject(Object json,IJsonSerializerStrategy jsonSerializerStrategy)    在SimpleJson.SimpleJson.SerializeObject(Object json)    在Facebook.JsonSerializer.SimpleJsonSerializer.SerializeObject(Object obj)    在Facebook.FacebookUtils.ToJsonQueryString(IDictionary 2 dictionary) at Facebook.FacebookClient.BuildRequestData(Uri uri, IDictionary 2个参数,HttpMethod httpMethod,Uri& requestUrl,String& contentType)    在Facebook.FacebookClient.BuildRequestData(String path,IDictionary 2 parameters, HttpMethod method, Uri& requestUrl, String& contentType) at Facebook.FacebookClient.ApiAsync(String path, IDictionary 2个参数,HttpMethod httpMethod,Object userToken)    在Facebook.FacebookClient.PostAsync(字符串路径,IDictionary 2 parameters, Object userToken) at Facebook.FacebookClient.PostAsync(String path, IDictionary 2个参数)    在CallSite.Target(Closure,CallSite,FacebookClient,String,Object)    在System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3 [T0,T1,T2](CallSite站点,T0 arg0,T1 arg1,T2 arg2)

0 个答案:

没有答案