Blazor WASM Project Throws System.Drawing.Common Is Not Supported
Environment
Product | Progress® Telerik® Reporting |
Description
When trying to render Telerik reports programmatically with the ReportProcessor in a Blazor WebAssembly (WASM) project the following error gets thrown.
Error Message
Unhandled exception rendering component: System.Drawing.Common is not supported on this platform.
System.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform.
at System.Drawing.Image..ctor()
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at BlazorApp_empty1.Pages.Index.OnButtonClick2() in D:\Program Files\Progress\Telerik Reporting R3 2022\Examples\CSharp\.NET 7\BlazorApp-empty1\Pages\Index.razor:line 32
at Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync[Object](MulticastDelegate delegate, Object arg)
at Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync(Object arg)
at Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, Object arg)
at Microsoft.AspNetCore.Components.EventCallback.InvokeAsync(Object arg)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs)
Cause\Possible Cause(s)
The problem relates to the fact that Blazor WASM is built on the Mono project:
For that reason Blazor WASM projects don't support the System.Drawing.Common functionality as discussed in the following threads:
- Adding system.drawing.common to a Blazor app causes the linker to fail
- blazor - captcha issue System.Drawing.Common is not supported
Suggested Workarounds
The ReportProcessor or the Reporting REST Service should be hosted in a different project type, for example, Blazor Server, which supports System.Drawing.Common.
The generated reports may be displayed in the Blazor Report Viewer or Native Blazor Report Viewer hosted in a Blazor WebAssembly project.
Notes
The problem will be solved when we implement the feature request described in Future of Linux support for reporting.