TargetInvocationException: Exception has been thrown by the target of an invocation

265 views
Skip to first unread message

Madhu

unread,
Oct 11, 2010, 5:22:31 AM10/11/10
to AdWords API Forum
Hi,

I am getting this error message when creating a adword user.
Please help me to fix this error

------------------Code--------------------------------
using Google.Api.Ads.AdWords.Lib;
using Google.Api.Ads.AdWords.v201008;

Dictionary<string, string> headers = new Dictionary<string,
string>();
headers.Add("email","email");
headers.Add("password", "*******");
headers.Add("useragent", "****");
headers.Add("developerToken", "*******");
headers.Add("service", "adwords");
headers.Add("applicationToken", *****");
headers.Add("clientEmail", "email");
//AdWordsUser user = new AdWordsUser(headers);

AdWordsUser user = new AdWordsUser(headers);

---------------------------error----------------------------------

[ArgumentNullException: Value cannot be null.
Parameter name: settings]
Google.Api.Ads.Common.Lib.AppConfigBase.ReadSetting(Hashtable
settings, String key, String defaultValue) +127
Google.Api.Ads.Common.Lib.AppConfigBase.ReadSettings(Hashtable
settings) +111
Google.Api.Ads.AdWords.Lib.AdWordsAppConfig.ReadSettings(Hashtable
settings) +53
Google.Api.Ads.AdWords.Lib.AdWordsAppConfig..ctor() +309
Google.Api.Ads.AdWords.Lib.LegacyAdWordsServiceFactory..ctor() +56

[TargetInvocationException: Exception has been thrown by the target of
an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
publicOnly, Boolean noCheck, Boolean& canBeCached,
RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
fillCache) +86
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean
skipVisibilityChecks, Boolean fillCache) +230
System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
System.Activator.CreateInstance(Type type) +6
Google.Api.Ads.Common.Lib.AdsUser.RegisterServices(Type[]
servicesFamilies) +427
Google.Api.Ads.Common.Lib.AdsUser..ctor() +108
Google.Api.Ads.AdWords.Lib.AdWordsUser..ctor() +78
_Default.GetAllAdGroups() in c:\inetpub\wwwroot\Google
\Default.aspx.cs:96
_Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot
\Google\Default.aspx.cs:22
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp,
Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
sender, EventArgs e) +89
System.Web.UI.Control.OnLoad(EventArgs e) +148
System.Web.UI.Control.LoadRecursive() +122
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+3414


Thanks in advance
Madhu

AdWords API Advisor

unread,
Oct 12, 2010, 6:47:26 AM10/12/10
to AdWords API Forum
Hi Madhu,

This was an issue with v11.0.0 of .NET library, it is fixed in
v11.1.0. The library throws this error when it cannot find AdWordsApi
node in your App.config/Web.config, so copying the nodes from
http://code.google.com/p/google-api-adwords-dotnet/source/browse/branches/v11.0/src/App.config
to your Web.config should fix the issue as well.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

Madhu

unread,
Oct 12, 2010, 9:24:50 AM10/12/10
to AdWords API Forum
HI Anash,

Thanks for the reply.
I have done as you have suggested.
I am now getting the following error.

Could not find any resources appropriate for the specified culture or
the neutral culture. Make sure
"Google.Api.Ads.Common.CommonErrorMessages.resources" was correctly
embedded or linked into assembly "Google.AdWords" at compile time, or
that all the satellite assemblies required are loadable and fully
signed.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Resources.MissingManifestResourceException:
Could not find any resources appropriate for the specified culture or
the neutral culture. Make sure
"Google.Api.Ads.Common.CommonErrorMessages.resources" was correctly
embedded or linked into assembly "Google.AdWords" at compile time, or
that all the satellite assemblies required are loadable and fully
signed.

Source Error:


Line 95: //AdWordsUser user = new AdWordsUser(headers);
Line 96:
Line 97: AdWordsUser user = new AdWordsUser();
Line 98:
Line 99:


Source File: c:\inetpub\wwwroot\Google\Default.aspx.cs Line: 97

Stack Trace:


[MissingManifestResourceException: Could not find any resources
appropriate for the specified culture or the neutral culture. Make
sure "Google.Api.Ads.Common.CommonErrorMessages.resources" was
correctly embedded or linked into assembly "Google.AdWords" at compile
time, or that all the satellite assemblies required are loadable and
fully signed.]
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
culture, Boolean createIfNotExists, Boolean tryParents) +7680590
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
culture, Boolean createIfNotExists, Boolean tryParents) +583
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
culture, Boolean createIfNotExists, Boolean tryParents) +583
System.Resources.ResourceManager.GetString(String name, CultureInfo
culture) +74

Google.Api.Ads.Common.CommonErrorMessages.get_AuthTokenLoginFailed()
+73
Google.Api.Ads.Common.Lib.AuthToken.ExtractException(WebException
ex) +691
Google.Api.Ads.Common.Lib.AuthToken.GetToken() +859

Google.Api.Ads.AdWords.Lib.AdWordsServiceFactory.MakeRequestHeaders(Dictionary`2
headers) +310

Google.Api.Ads.AdWords.Lib.AdWordsServiceFactory.SetHeaders(Dictionary`2
headers) +56
Google.Api.Ads.Common.Lib.AdsUser.SetHeadersFromConfig() +185
Google.Api.Ads.Common.Lib.AdsUser..ctor() +186
Google.Api.Ads.AdWords.Lib.AdWordsUser..ctor() +78
_Default.GetAllAdGroups() in c:\inetpub\wwwroot\Google
\Default.aspx.cs:97
_Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot
\Google\Default.aspx.cs:23
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) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+627


Thanks
Madhu

On Oct 12, 11:47 am, AdWords API Advisor
<adwordsapiadvi...@google.com> wrote:
> Hi Madhu,
>
> This was an issue with v11.0.0 of .NET library, it is fixed in
> v11.1.0. The library throws this error when it cannot find AdWordsApi
> node in your App.config/Web.config, so copying the nodes fromhttp://code.google.com/p/google-api-adwords-dotnet/source/browse/bran...
> > Madhu- Hide quoted text -
>
> - Show quoted text -

AdWords API Advisor

unread,
Oct 13, 2010, 7:50:17 AM10/13/10
to AdWords API Forum
Hi Madhu,

Looks like an issue with the binary build. I've opened a bug at
http://code.google.com/p/google-api-adwords-dotnet/issues/detail?id=47.
I'll try to upload a fix by later tonight.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

> Google.Api.Ads.AdWords.Lib.AdWordsServiceFactory.MakeRequestHeaders(Diction ary`2
Reply all
Reply to author
Forward
0 new messages