-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Urgent] FinalUrls is READONLY #337
Comments
Hi, Thanks for opening the issue here. The error you received looks to be due to there being zero final URLs on the ad sent in the request. Does the ad you're copying from ( Thanks |
Yes, the property FinalUrls collection is blank. |
I am hitting this issue as well with setting the FinalURls property on the AdGroupCriterion object. It is read only in both versions 9 and 10.2 which I just upgraded to. |
There seems to be multiple issues being discussed on this thread, so let me go over them one by one.
private void TryArrayInitialize()
{
Ad oAdGroupAd = new Ad();
string oAdGroup = "";
AdGroupAd adGroupAd = new AdGroupAd
{
AdGroup = oAdGroup,
// Optional: Set the status.
Status = AdGroupAdStatus.Paused,
Ad = new Ad
{
FinalUrls = { oAdGroupAd.FinalUrls },
ExpandedTextAd = new ExpandedTextAdInfo
{
}
}
};
} The relevant C# feature is discussed here: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/object-and-collection-initializers#object-initializers-with-collection-read-only-property-initialization
google-ads-dotnet/src/V8/Types/Ad.g.cs Lines 301 to 303 in 86eefe5
google-ads-dotnet/src/V8/Types/Ad.g.cs Lines 290 to 293 in 127ae51
Can someone provide a minimal project that helps replicate this issue? I am using
And for command line:
And OS version:
The following projects compile fine locally. |
@AnashOommen thank you for staying on this issue.
The issue is that the FinalURLs property is ReadOnly in 10.2.0.0 and I am
not able to set its value as you suggested
FinalUrls = { oAdGroupAd.FinalUrls }
|
[image: image.png]
… |
@ullfindsmit can you please attach a minimal project that illustrates the issue? Or otherwise, confirm if you can compile the attached Compilation Issues.zip? |
I was finally able to get it to work.
The solution was to not use the inline declaration but instead to create a
new Ad object
Then instead of assigning the final urls, simply using
oAd.FinalURLs.Add("string")
… Message ID: ***@***.***>
|
Describe the bug:
FinalURLs is now readonly so I removed the line and now I get an error when trying to create a new Ad.
In the latest library the FinalUrls property is READONLY
Assembly Google.Ads.GoogleAds, Version=10.2.0.0, Culture=neutral, PublicKeyToken=52807268f2b614dc
However, in the earlier version it was NOT readonly.
Assembly Google.Ads.GoogleAds, Version=10.1.0.0, Culture=neutral, PublicKeyToken=52807268f2b614dc
What is the new way to set the FinalURLs value?
Steps to Reproduce:
Expected behavior:
Backward compatibility or documentation on how to fix.
Client library version and API version:
Assembly Google.Ads.GoogleAds, Version=10.2.0.0, Culture=neutral, PublicKeyToken=52807268f2b614dc
.NET version: Latest
Operating system (Linux, Windows, ...) and version (if the bug is platform-specific): Windows 10
Request/Response Logs:
{
"StatusCode": 3,
"Details": "Request contains an invalid argument.",
"RequestId": "--removed--",
"Failure": {
"errors": [
{
"errorCode": {
"collectionSizeError": "TOO_FEW"
},
"message": "Too few.",
"location": {
"fieldPathElements": [
{
"fieldName": "operations",
"index": 0
},
{
"fieldName": "create"
},
{
"fieldName": "ad"
},
{
"fieldName": "final_urls"
}
]
}
}
],
"requestId": "--removed--"
}
}
Anything else we should know about your project / environment
Not at the moment.
The text was updated successfully, but these errors were encountered: