Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Issue with Power BI client in C#

Hello team,

My Azure function is failing sometimes and I am not able to understand the reason behind this.

 

The execution flow of the Azure function is shown as below:

GetAccessToken -> CreatePowerBIClient -> ExportPowerBIReports


When I checked the logs of my Azure function, It is containing few failures.

Exception: System.AggregateException
Message: One or more errors occurred. (An error occurred while sending the request.)

This Exception is occuring exactly when I called "clientApp.AcquireTokenForClient(scopes).ExecuteAsync().Result" to get Azure AD token for service principal

 

In some other cases, I am getting the below exception message when trying to retrieve the PowerBIReports using PowerBIClient

 Client.Reports.GetReportsAsync

Exception: TaskCanceledException
Message: The operation was canceled.

I would like to know if there is any issue with Power BI client in .NET

 

 

 

 

 

 

 

 

 

 

Status: Investigating

Hi @Anonymous 

At present, there is no similar case about your problem . When did your question start ?

 

Best Regards,
Community Support Team _ Ailsa Tao

Comments
v-yetao1-msft
Community Support
Status changed to: Investigating

Hi @Anonymous 

At present, there is no similar case about your problem . When did your question start ?

 

Best Regards,
Community Support Team _ Ailsa Tao

Anonymous
Not applicable

Hello @v-yetao1-msft ,

 

I am facing this issue from last one week.

When retrieving reports asynchronously from the Power BI Client, client is returning the below mentioned exception

This exception is exactly thrown at this line of code :  Client.Reports.GetReportsAsync

Exception: TaskCanceledException
Message: The operation was canceled.

 

Adding stack trace for more information:

 

{"account":"****","action":"PollStatus","reportsExported":"2","reportsUploaded":"0","exceptionType":"System.Threading.Tasks.TaskCanceledException","response":"Failed","startDateTime":"2022-09-19T07:23:59.5638368Z","logType":"Error","totalReports":"11","emailStatus":"0","utilityName":"Scheduler","endDateTime":"2022-09-19T07:26:14.3069141Z","exceptionMessage":"The operation was canceled.","stackTrace":"at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync(HttpConnection connection, HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)\r\n at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at Microsoft.Rest.RetryAfterDelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at Microsoft.Rest.RetryDelegatingHandler.<>c__DisplayClass15_0.<<SendAsync>b__0>d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at Microsoft.Rest.RetryDelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)\r\n at Microsoft.PowerBI.Api.ReportsOperations.GetFileOfExportToFileInGroupWithHttpMessagesAsync(Guid groupId, Guid reportId, String exportId, Dictionary`2 customHeaders, CancellationToken cancellationToken)\r\n at Microsoft.PowerBI.Api.ReportsOperationsExtensions.GetFileOfExportToFileAsync(IReportsOperations operations, Guid groupId, Guid reportId, String exportId, CancellationToken cancellationToken)\r\n at PBIUtilities.PbiService.GetExportedFile(Guid reportId, Guid groupId, Export export) in D:\\GIT\\Juniper\\JSI-PowerBI-Utility\\PBIUtilityFunctions\\PBIUtilities\\Helper\\PbiService.cs:line 377\r\n at PBIUtilities.PbiService.ExportPowerBIReport(Guid reportId, Guid groupId, FileFormat format, String exportId, Int32 pollingtimeOutInMinutes, IList`1 pageNames, String urlFilter) in D:\\GIT\\Juniper\\JSI-PowerBI-Utility\\PBIUtilityFunctions\\PBIUtilities\\Helper\\PbiService.cs:line 446\r\n at PBIUtilities.FunSendNotification.Run(String myQueueItem, ILogger log) in D:\\GIT\\Juniper\\JSI-PowerBI-Utility\\PBIUtilityFunctions\\PBIUtilities\\FunSendNotification.cs:line 132","scheduleId":"68"}