Clicking the cancel button on the HTML5 report viewer show "Report processing was canceled" in the UI but the report is still being generated and rendered on the server.
In this old thread it is stated that it isn't possible to cancel the report generation on the server. Is that still the case?
I see that this bug report never got updated with the final resolution. In the support ticket that I opened to resolve my issue, the support team member suggested the following test.
We log information about how much the processing and the rendering of the report take and it should be available in the generated log(s). The time when the report was canceled should be lower than when rendering it full and it should prove that the canceling is taking effect.
For guidance on how to use the Trace Listener, please see the Troubleshooting reporting implementation into ASP.NET Core application KB article.
After following these instructions, I discovered that we were incorrectly dispatching the report from the HTML report viewer and that no less than FOUR instances of each report were being run each time we dispatched a report. The cancel button would cancel the last instance of the report but the first three would continue until they finished or server resources were exhausted. Once we fixed our React rendering issue so that the reports were only dispatched once, the cancel button functioned as we expected.
Hello,
Our apologies if the question was misunderstood.
The CancellationToken is being sent automatically by the report viewer when the 'Cancel' button on the report viewer toolbar is clicked, no additional C# code is required for this functionality to work.
The case is currently being discussed in a separate support ticket. If a problem with the HTML5 Report Viewer cancellation of the report rendering is discovered, this item will be updated to reflect it.
Regards,
Dimitar
Progress Telerik
My apologies for not making myself clear enough.
Clicking the cancel button causes the UI to display "Report processing was canceled" and the report never displays in the viewer. This is expected and correct behavior.
However, if you watch the report servers' resource consumption (RAM, CPU, etc.) it is obvious that the server is still rendering the report as the resource consumption continues to grow until the report has finished rendering.
I know how to use task cancellation tokens in other C# coding that I do but I couldn't find documentation on how to use the Cancellation Token when using your HTML5 report viewer and Reporting REST service. Could you point me to the documentation please?
Hi Melvin,
I confirm that you may cancel the report rendering by passing Cancellation Token to the RenerReport and PrintReport methods of the ReportProcessor. We introduced this feature with R2 2020 (14.1.20.513) - Allow the ReportProcessor to cancel the current report rendering. The cancellation is available also to the viewers with our latest versions.
Please, note that the cancellation doesn't happen immediately. If report generation is fast enough, the report may be already rendered before the cancellation token is passed to the ReportProcessor as the request for cancellation is sent through the Reporting REST Service.
I tested with our ReportBook online demo and managed to cancel the rendering. The first report was already rendered, but the rendering of the rest of the reports in the book was effective. I tried also with our examples and managed to cancel the report rendering in debug mode.
For the above reasons, I have marked this bug report as declined.
Regards,
Todor
Progress Telerik