Free Support Forum - aspose.com

Compatibility with Blazor (Web Assembly)

Hi there,

Blazor is looking like a promising and powerful technology that could drive a lot of .NET development. I was playing around with integrating Aspose.Cells and was disappointing to learn that the library can’t run in Blazor because it contains native code (See this for a similar error to what I get). Are there any plans to change this? It would be a very powerful feature if it were included.

Steps to reproduce:

Make sure you have preview 9 of dotnet

λ dotnet --version
3.0.100-preview9-014004

Download the templates so you can create the project

λ dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview9.19424.4
λ dotnet new blazorwasm -o AsposeOnBlazor

λ cd AsposeOnBlazor
λ dotnet add package Aspose.Cells

Add this to ./_Imports.razor:

@using Aspose.Cells

Now build the project
λ dotnet build

You should see error MSB3073.

@alexmclean,
We have understood the requirement and we need to look into it more. We have logged the issue in our database for investigation and for a fix (if possible). Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46895 – Compatibility with Blazor (Web Assembly)

Any update on this? @ahsaniqbalsidiqui

@alexmclean,
We are working on this issue but cannot provide any ETA due to its complexity. We will write back here immediately once any feedback is ready to share.

@alexmclean,

Well, we conducted some tests to check the possibility to use Aspose.Cells .NetStandard lib in a Blazor project.

Test 1 (Following your steps):

dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview9.19424.4
dotnet new blazorwasm -o AsposeOnBlazor
cd AsposeOnBlazor
dotnet add package Aspose.Cells
dotnet build

Then we get the error:

Fatal error in IL Linker
Unhandled Exception: Mono.Cecil.ResolutionException: Failed to resolve System.Security.Permissions.PermissionSetAttribute

But “System.Security.Permissions.PermissionSetAttribute” is needed in Aspose.Cells lib. Now we use it in AssemblyInfo. And, this property also exists in .NetStandard interface, I am afraid, now we have no idea why this standard property causes this IL Linker error.

Test 2 (We only use System.Drawing.common lib):

dotnet new blazorwasm -o AsposeOnBlazor2
cd AsposeOnBlazor2
dotnet add package System.Drawing.common
dotnet build

Then we again get the error:

Fatal error in IL Linker
Unhandled Exception: Mono.Linker.MarkException: Error processing method: ‘System.Void System.Drawing.Bitmap::.ctor(System.Drawing.Image,System.Drawing.Size)’ in assembly: ‘System.Drawing.Common.dll’ —> Mono.Cecil.ResolutionException: Failed to resolve System.Drawing.Size

As Micorsoft supports drawing functions in .NetStandard by using System.Drawing.common, now Aspose.Cells also needs to call it for drawing activities. But then we create an empty Blazor project, only add System.Drawing.common from Nuget, we also get the IL Linker error.

So, we doubt that, maybe now Blazor project does not support .NetStandard very well. As we know,
“System.Security.Permissions.PermissionSetAttribute” is a property that exists in .NetStandard interface. Also, “System.Drawing.common” is a nuget package develop by Micorsoft for .NetStandard drawing. So, would you please check it again in your develop. environment, to see if it will cause the same error? If it does, we think now it is very hard to support Blazor project. Anyway, we will keep an eye on it to see if .NetCore 3.0 official version will improve this.