googleads / google-ads-dotnet

This project hosts the .NET client library for the Google Ads API.

Home Page:https://developers.google.com/google-ads/api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ExperimentService.MutateExperiments not returning response

nicolei1979 opened this issue · comments

Describe the bug:
Working on upgrading Campaign Experiments logic from V9 to V12. The ExperimentServiceClient.MutateExperiments() is not returning a response or an error/exception. It seems to actually create the experiment (I can log into the Google Ads online tools and see the experiment after a few mins), but the code just hangs and waits indefinitely for a response.

Note: I did contact Google Ads API Direct Support, googleadsapi-support@google.com, and they responded that it seems to be an issue with the library and not the api.

Steps to Reproduce:

ExperimentServiceClient experimentService = client.GetService(Services.V12.ExperimentService);
			
Experiment experiment = new Experiment()
{
	Name = "Target CPA vs Target CPA - Exact Match ↑",
	Type = ExperimentType.SearchCustom,
	Suffix = "[experiment]",
	Status = ExperimentStatus.Setup,
	StartDate = "2023-01-20", 
	EndDate = "2023-02-20" 
};

ExperimentOperation operation = new ExperimentOperation()
{
	Create = experiment
};

var request = new MutateExperimentsRequest
{
	CustomerId = customerId,
	ValidateOnly = false
};
request.Operations.Add(operation);

MutateExperimentsResponse response = experimentService.MutateExperiments(request);
return response.Results.First().ResourceName;

Expected behavior:
The method should return the Resource Name of the experiment just created.

Client library version and API version:
Client library version: Google.Ads.GoogleAds 14.2.0 (latest version)
Google Ads API version: V12
.NET version: .NET Framework 4.7.2
Operating system: Windows 10

Request/Response Logs:
No logs are created because the process just hangs on the following line from the code snippet above:

MutateExperimentsResponse response = experimentService.MutateExperiments(request);

Anything else we should know about your project / environment

Try using the async version.

MutateExperimentsResponse response = await experimentService.MutateExperimentsAsync(request);

The sync versions don't always work well with some legacy .NET environments.