What Changed
ASP.NET Core
- The ReportDesignerController, WebDocumentViewerController and QueryBuilderController classes became abstract.
- The StartupExtensions.AddDefaultReportingControllers and StartupExtensions.RemoveDefaultReportingControllers methods became obsolete.
Blazor (Server)
- The DownloadExportResultController class became obsolete.
- We have implemented the
DownloadExportResultControllerBase
abstract base class. - The StartupExtensions
AddDevExpressServerSideBlazorReportViewerControllers
andRemoveDevExpressServerSideBlazorReportViewerControllers
methods became obsolete.
Reasons for Change
We made controller classes abstract to reduce possible security issues.
Impact on Existing Apps
The Report Designer, Document Viewer (Report Viewer in Native Blazor), and Query Builder controls will not work properly without the controller classes, explicitly implemented by the application developer.
When the ASP.NET Core application that references the DevExpress.AspNetCore.Reporting
package starts, it searches for the WebDocumentViewerController
descendant. If the search fails, an exception is thrown with a message that contains a link to this article.
Affected Apps
- This breaking change will affect your ASP.NET Core application, if you use ReportDesigner, WebDocumentViewer, or QueryBuilder controls, and have not explicitly declared the corresponding controller classes.
- This breaking change will affect your Blazor (Server) application, if you use ReportDesigner or ReportViewer controls, and have not explicitly declared the corresponding controller classes.
How to Update Existing Apps
Do the following:
1. Remove obsolete methods
Remove calls to the following obsolete methods:
- StartupExtensions.AddDefaultReportingControllers
- StartupExtensions.RemoveDefaultReportingControllers
StartupExtensions.AddDevExpressServerSideBlazorReportViewerControllers
StartupExtensions.RemoveDevExpressServerSideBlazorReportViewerControllers
2. Implement controller classes
Explicitly declare controllers that descend from the built-in base classes. To implement controller classes, create the ReportControllers.cs
file with the following content:
ASP.NET Core and Blazor (Server) with JS-Based reporting controls
C#using DevExpress.AspNetCore.Reporting.QueryBuilder;
using DevExpress.AspNetCore.Reporting.QueryBuilder.Native.Services;
using DevExpress.AspNetCore.Reporting.ReportDesigner;
using DevExpress.AspNetCore.Reporting.ReportDesigner.Native.Services;
using DevExpress.AspNetCore.Reporting.WebDocumentViewer;
using DevExpress.AspNetCore.Reporting.WebDocumentViewer.Native.Services;
// ...
public class CustomWebDocumentViewerController : WebDocumentViewerController {
public CustomWebDocumentViewerController(IWebDocumentViewerMvcControllerService controllerService) : base(controllerService) {
}
}
public class CustomReportDesignerController : ReportDesignerController {
public CustomReportDesignerController(IReportDesignerMvcControllerService controllerService) : base(controllerService) {
}
}
public class CustomQueryBuilderController : QueryBuilderController {
public CustomQueryBuilderController(IQueryBuilderMvcControllerService controllerService) : base(controllerService) {
}
}
Blazor (Server) - Native Report Viewer Control
C#using DevExpress.Blazor.Reporting.Controllers;
using DevExpress.Blazor.Reporting.Internal.Services;
// ...
public class DownloadExportResultController : DownloadExportResultControllerBase {
public DownloadExportResultController(ExportResultStorage exportResultStorage) : base(exportResultStorage) {
}
}
You can find the files with the required controllers in the attachment. Add the appropriate file to your project.
How to Hide an Exception in ASP.NET Core App
In the ASP.NET Core Reporting application, you can prevent an exception from being thrown if, for some reason, your application can operate without the WebDocumentViewerController
descendant. Note that hiding the exception does not solve the problem. You should follow the recommended steps described earlier in the How to Update Existing Apps section, or turn off controller diagnostics and implement your own solution. The following code disables controller diagnostics:
C#public void ConfigureServices(IServiceCollection services) {
// ...
services.ConfigureReportingServices(configurator => {
configurator.DisableCheckForCustomControllers();
// ...
});
// ...
}
How to Revert to the Previous Behavior
You cannot revert to the previous behavior.