googleads / googleads/googleads-dotnet-lib

Could not load file or assembly 'Google.Apis.Auth, Version=1.36.1.0

Open
#210 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P2
Dominant language
C#
Stars
108
Forks
198
PR merge metrics
No merged PRs in 30d

Description

I am having the same issue as in the following issue #208

However, I am not updating I am adding those dependencies for the first time. I am unable to run an example successfully. I added the required configuration to a config file extracted an IConfigurationSection out of it and created an AdWordsUser to run the example.

var config = new AdWordsAppConfig(section);
codeExample.Run(new AdWordsUser(config));

The configuration settings get loaded successfully, but I get the following error:

System.IO.FileLoadException: Could not load file or assembly 'Google.Apis.Auth, Version=1.36.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab'. An operation is not legal in the current state. (Exception from HRESULT: 0x80131509)
File name: 'Google.Apis.Auth, Version=1.36.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab'
   at Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.RefreshAccessTokenInOfflineMode()
   at Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.GetAuthHeader()
   at Google.Api.Ads.Common.OAuth.OAuthClientMessageInspector.BeforeSendRequest(Message& request, IClientChannel channel)
   at System.ServiceModel.Dispatcher.ImmutableClientRuntime.BeforeSendRequest(ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.PrepareCall(ProxyOperationRuntime operation, Boolean oneway, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(MethodCall methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod, Object[] args)
--- End of stack trace from previous location where exception was thrown ---
   at System.Reflection.DispatchProxyGenerator.Invoke(Object[] args)
   at generatedProxy_1.get(Selector )
   at Google.Api.Ads.AdWords.Examples.CSharp.v201806.GetCampaigns.Run(AdWordsUser user) in C:\Projects\aws-csharp-vs\FirstApiCall.cs:line 79

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure from the C# example at FirstApiCall.cs line 79, using AdWordsAppConfig and AdWordsUser as described. Read the OAuth call path around AdsOAuthProviderImpl.RefreshAccessTokenInOfflineMode and inspect how Google.Apis.Auth is loaded. Done means the example completes its API call without the FileLoadException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.