Issues with Azure Management SDK Deadlocking an await call in C#.

Will Miller 1 Reputation point

I am trying to build an application that Clones an Azure hosted database using the Azure.Management.Fluent SDK in C#. from the controller I am making a call to the CloneDbService CloneDB method.


The CloneDB call is Async so I have used the Wait() method.

once I am into the actual service call I get the Azure Credentials object as well as the IAzure object with no issues.

                    AzureCredentials credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(ClientId, ClientSecret, TenantId, AzureEnvironment.AzureGlobalCloud);

                    IAzure azure = Azure

where the issues come up is in the next section of the process where I attempt to get the SqlServer instance.

                    ISqlServer sqlServer = await azure.SqlServers.GetByResourceGroupAsync(model.SelectedOpsDatabase.ResourceGroupName, model.SelectedOpsDatabase.SQLServerName);

This call will deadlock and never finish. I have added Aggregate Exception Handling to see if I was getting an exception but it wasn't being picked up correctly.

                    catch (AggregateException ae)
                        foreach (Exception ex in ae.InnerExceptions)

but there are no errors being caught.

First I thought the issue was using the actual SDK so I attempted to do the same call with the REST API and the call still deadlocked. I am at a loss for what may be causing this any help would be appreciated.

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,401 questions
0 comments No comments
{count} votes