title: facebook c# 5 - FacebookWebClient throws Typeinitializer-exception
body: <p>my problem is as follows: I have just migrated from using the Facebook C# API 4 -> v. 5.0.50 (as of 2011-07-11), therefore I had to change some lines of code and started using the FacebookWebClient instead of the former FacebookApp. I use this class to navigate the Graph API. I use the functionality inside a WCF service, which receives only the access_token as a parameter, which it passes to the FacebookWebClient.</p>
  
  <p>Everything worked just fine under v.4, however after replacing and re-referencing the dlls the application started throwing the exception "<strong>The type initializer for 'Facebook.FacebookApplication' threw an exception.</strong>"</p>
  
  <hr>
  
  <p>The exception stack trace is:</p>
  
  <p>at Facebook.FacebookClient..ctor(String accessToken) in e:\Prabir\Documents\Projects\facebooksdk\v5.0.50\Source\Facebook\FacebookClient.cs:line 48 at Facebook.Web.FacebookWebClient..ctor(String accessToken) in e:\Prabir\Documents\Projects\facebooksdk\v5.0.50\Source\Facebook.Web\FacebookWebClient.cs:line 36 at Korito.MyKorito.FetchKorito(String token) at Korito.MyKorito.KoritoAPI(String token) at SyncInvokeKoritoAPI(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</p>
  
  <hr>
  
  <p>I have referenced (only) the following dll-s: </p>
  
  <ul>
  <li>facebook.dll</li>
  <li>facebook.web.dll</li>
  <li>facebook.web.mvc.dll</li>
  </ul>
  
  <p>the code segment is as follows:</p>
  
  <p>var client = new Facebook.Web.FacebookWebClient("/*auth_token_received_as_a_parameter*/");
  dynamic me = client.Get("/me");</p>
  
  <p>I use the .net 4 framework.</p>
  
  <p>Any assistance is much appreciated!
  Cheers,
  Alois</p>