lkosson / reportviewercore

Recompilation of Microsoft.ReportViewer for .NET Core 3.1+
401 stars 119 forks source link

Blazor Web Assembly Support. #56

Open SPEMoorthy opened 3 years ago

SPEMoorthy commented 3 years ago

Hi @lkosson,

Am trying to generate report in Blazor Client side (WebAssembly), Got Unsupported platform exception. Do you have any roadmap to to support webassembly (Mono engine)?

Easwar

lkosson commented 3 years ago

Hello,

Please provide a full stack trace of the exception. I know little about Blazor, but chances of RV compiled to WebAssembly working are slim; most likely limited to HTML, DOCX and XLSX formats only - mostly due to heavy reliance on native Windows DLLs for page layout and typography.

SPEMoorthy commented 3 years ago

Hi Sample code in written i a .razor page

image

And the error is like as follows

image

All in Textual format

ReportViewerCore_Error.log

Note :- I also tried with html, excel format also... Same error.

Regards, Easwar

lkosson commented 3 years ago

Most likely ReportViewer won't work in Blazor. While the error you've encountered can be fixed (call to Process.GetCurrentProcess() can be removed or guarded when running in Blazor), report compilation using Roslyn won't work due to issues similar to reported in #49 regarding single-exe deployment.

Nevertheless, I'll fix the call in upcoming version. Perhaps at some time I'll come up with a solution to both issues.

SPEMoorthy commented 3 years ago

@lkosson , Thanks for prompt reply. Let the Issue open. Will try to fix the problem. This would help a lot for rendering report using the local processing power instead of server resources.

Thanks & Regards, Easwar

lkosson commented 3 years ago

Apart from bypassing Process.GetCurrentProcess(), Blazor support requires changes to ExprHostCompiler and VBExpressionCodeProvider to pass runtime and user DLL references to Roslyn compiler in a way that is mutually exclusive with the one used now. It might be possible to fork the ReportViewer to target Blazor environment, but as of now, I see no way of providing a single .nuget package which works both in Blazor and .NET Core.

I'll leave the issue open, perhaps someone can pick it up and maintain such fork of this project.

luisbillr commented 2 years ago

I'm working with it on Blazor Server Side, API .NET Core and Front End in Blazor Server Side. This work perfectly, try to put the report.rdlc on [wwwroot] folder in the API project:

Screenshot_3

Then, in the , create a generic report base, in the controller just call this report base.

image

then from the controller call the report

image

Sorry for the spanish words on the pics

won5572 commented 9 months ago

I'm working with it on Blazor Server Side, API .NET Core and Front End in Blazor Server Side. This work perfectly, try to put the report.rdlc on [wwwroot] folder in the API project:

Screenshot_3

Then, in the , create a generic report base, in the controller just call this report base.

image

then from the controller call the report

image

Sorry for the spanish words on the pics

Did it work on Blazor Server Side & Docker & Linux? I got this error. How can I fix this?

An unhandled exception occurred while processing the request. DllNotFoundException: Unable to load shared library 'usp10.dll' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.0/usp10.dll.so: cannot open shared object file: No such file or directory /app/bin/Debug/net8.0/usp10.dll.so: cannot open shared object file: No such file or directory /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.0/libusp10.dll.so: cannot open shared object file: No such file or directory /app/bin/Debug/net8.0/libusp10.dll.so: cannot open shared object file: No such file or directory /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.0/usp10.dll: invalid ELF header /app/bin/Debug/net8.0/usp10.dll: cannot open shared object file: No such file or directory /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.0/libusp10.dll: cannot open shared object file: No such file or directory /app/bin/Debug/net8.0/libusp10.dll: cannot open shared object file: No such file or directory Microsoft.ReportingServices.Rendering.RichText.Win32.ScriptItemize(string pwcInChars, int cInChars, int cMaxItems, ref SCRIPT_CONTROL psControl, ref SCRIPT_STATE psState, out SCRIPT_ITEM[] pItems, ref int pcItems)

LocalProcessingException: An error occurred during local report processing. Microsoft.Reporting.NETCore.LocalReport.InternalRender(string format, bool allowInternalRenderers, string deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, out Warning[] warnings)

This is the part of my Dockerfile.

RUN apt-get update \ && apt-get install -y wine --no-install-recommends libgdiplus \ && ln -s /usr/lib/libgdiplus.so /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.0/ \ && ln -s /usr/lib/x86_64-linux-gnu/wine/x86_64-windows/usp10.dll /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.0/

lkosson commented 9 months ago

It looks like you are using Linux version of .NET. PDF rendering won't work in such environment. You have to use .NET for Windows with Wine. See "Linux rendering workaround" section in readme.

won5572 commented 9 months ago

I understood your reply.