Tip:Windows Phone-익명 형식 과 MethodAccessException

wp7 애플 리 케 이 션 이 페 이 스 북 csharp sdk 를 참조 하 였 습 니 다. 의 dll,페 이 스 북 클 라 이언 트 에 전송 하 는 방법 중 익명 형식 을 사용 한 결과 MethodAccessException 을 던 졌 습 니 다.
      :

이상 코드:
fb.PostAsync("oauth/access_token",new
                                                          {
                                                              client_id = AppId,
                                                              client_secret = AppSecret,
                                                              redirect_uri = RedirectUri,
                                                              code = oauthResult.Code
                                                          });

이상 원인:익명 형식 은 internal 구성원 으로 컴 파일 되 며,크로스 프로그램 에 접근 할 때 이 이상 을 만 날 수 있 습 니 다.
해결 방법:익명 형식의 프로그램 집합 Assembly Info.cs 에서 다음 과 같은 기능 을 사용 할 수 있 습 니 다.
 foreach (var propertyInfo in parameters.GetType().GetProperties())
                {
                    if (!propertyInfo.CanRead) continue;
                    dictionary[propertyInfo.Name] = propertyInfo.GetValue(parameters, null);
                }

참고: 
http://stackoverflow.com/questions/8273399/anonymous-types-and-get-accessors-on-wp7-1
http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx

좋은 웹페이지 즐겨찾기