I'm building a very crude facebook application as a school project and I'v开发者_JAVA技巧e come across the most interesting error. When attempting to make any call to FacebookApp.Api() involving "me" I get the following exception:
System.TypeLoadException: Inheritance security rules violated while overriding member: Facebook.FacebookApiException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
Stack Trace:
[TypeLoadException: Inheritance security rules violated while overriding member: 'Facebook.FacebookApiException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.]
Facebook.FacebookApp.WithMirrorRetry(Func`1 body) in d:\Projects\facebooksdk\src\Facebook\FacebookApp.cs:758
Facebook.FacebookApp.OAuthRequest(Uri uri, IDictionary`2 parameters, HttpMethod httpMethod) in d:\Projects\facebooksdk\src\Facebook\FacebookApp.cs:545
Facebook.FacebookApp.Graph(String path, IDictionary`2 parameters, HttpMethod httpMethod) in d:\Projects\facebooksdk\src\Facebook\FacebookApp.cs:529
Facebook.FacebookAppBase.Api(String path, IDictionary`2 parameters, HttpMethod httpMethod) in d:\Projects\facebooksdk\src\Facebook\FacebookAppBase.cs:415
Facebook.FacebookAppBase.Api(String path) in d:\Projects\facebooksdk\src\Facebook\FacebookAppBase.cs:350
Callback.Page_Load(Object sender, EventArgs e) +622
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
As far as I can tell, the error comes from the fact that FacebookApiException is overriding Exception's getDataObject and not doing so with the correct security. However, I don't see FacebookApiException overriding the method at all in the source.
Any help would be appreciated.
This is a known bug in version 4.0.2 of the Facebook C# SDK. The bug is fixed in code and will be fixed in the next release. The fix is to run the App in full trust or to use the most recent build from source control.
精彩评论