title: Google Plus API C# - AccessViolationException
body: <p>I'm trying to reach the Google API Services (Plus Service in this case), using simple C# console application. Each time I call the API functions I'm encountering a very weird exception:</p>
  
  <blockquote>
    <p>An unhandled exception of type 'System.AccessViolationException'
    occurred in Unknown Module.</p>
    
    <p>Additional information: Attempted to read or write protected memory.
    This is often an indication that other memory is corrupt.</p>
  </blockquote>
  
  <p>This is happened when I'm getting the API endpoints like this example:</p>
  
  <pre><code>Client.People.Get("me").Execute();
  </code></pre>
  
  <p>Did anyone got this problem before?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I have downloaded the GPlus sample, and still getting the same problem, but now inside:</p>
  
  <pre><code>Oauth2Service.TokeninfoRequest request = service.Tokeninfo();
  </code></pre>
  
  <p>I think the common case here is about generated code classes:</p>
  
  <ol>
  <li><p><a href="https://code.google.com/p/google-api-dotnet-client/source/browse/20120425-1.1.4497-beta/Generated/Source/Google.Apis.Oauth2.v2.cs?repo=contrib&amp;name=20120503-1.2.4506-beta" rel="nofollow">https://code.google.com/p/google-api-dotnet-client/source/browse/20120425-1.1.4497-beta/Generated/Source/Google.Apis.Oauth2.v2.cs?repo=contrib&amp;name=20120503-1.2.4506-beta</a></p></li>
  <li><p><a href="https://code.google.com/p/google-api-dotnet-client/source/browse/Current/Generated/Source/Google.Apis.Plus.v1.cs?repo=contrib&amp;r=c757b64c06e143c8b28bda15b4ec7e6a2738d2e5" rel="nofollow">https://code.google.com/p/google-api-dotnet-client/source/browse/Current/Generated/Source/Google.Apis.Plus.v1.cs?repo=contrib&amp;r=c757b64c06e143c8b28bda15b4ec7e6a2738d2e5</a></p></li>
  </ol>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>I'm attaching the stacktrace:</p>
  
  <blockquote>
    <p>at Google.Apis.Plus.v1.PeopleResource.GetRequest.set_UserId(String value)
    at Google.Apis.Plus.v1.PeopleResource.GetRequest..ctor(IClientService service, String userId) in c:\code.google.com\google-api-dotnet-client\default_gen\Tools\Google.Apis.NuGet.Publisher\Template\Build\Google.Apis.Plus.v1.cs:line 2661
       at Google.Apis.Plus.v1.PeopleResource.Get(String userId) in c:\code.google.com\google-api-dotnet-client\default_gen\Tools\Google.Apis.NuGet.Publisher\Template\Build\Google.Apis.Plus.v1.cs:line 2649
       at Core.External.GoogleService.GooglePlusApplicationClient.Test() in e:\Copy\Feedly\Backend\Core.External.GooglePlus\GooglePlusApplicationClient.cs:line 34
       at FeedlyTest.Program.Main(String[] args) in e:\Projects\Feedly\Backend\Testing\Program.cs:line 88</p>
  </blockquote>
  
  <p><strong>EDIT 3:</strong></p>
  
  <p>When I'm using the Ctrl+F5 combination, it's working. 
  I read that combination is disabling the debugger. First thought, maybe in the debugger mode, the system is running at 32bit (and then can't access the memory which outside the 32bit boundary) . 
  I tried to change the debug platform to 64bit, but it wasn't help.</p>