Hi @leoluo,
We’re making some progress, the issue only seems to happen when the dotnet publish
options -p:PublishReadyToRun=true -p:PublishReadyToRunShowWarnings=true
are used.
(Documentation):
R2R binaries improve startup performance by reducing the amount of work the just-in-time (JIT) compiler needs to do as your application loads. The binaries contain similar native code compared to what the JIT would produce. However, R2R binaries are larger because they contain both intermediate language (IL) code, which is still needed for some scenarios, and the native version of the same code. R2R is only available when you publish an app that targets specific runtime environments (RID) such as Linux x64 or Windows x64.
Working:
RUN dotnet publish --configuration Release --runtime linux-musl-x64 --self-contained=true --output /app/publish
Not working
RUN dotnet publish --configuration Release --runtime linux-musl-x64 --self-contained=true -p:PublishReadyToRun=true -p:PublishReadyToRunShowWarnings=true --output /app/publish
Testing Aspose.Cells under .NET 6 & Linux
Unhandled exception. System.TypeLoadException: Cannot load type '♠ , Aspose.Cells, Version=21.12.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56'.
at Aspose.Cells.Workbook.Save(String fileName, SaveOptions saveOptions)
at Aspose.Cells.Workbook.Save(String fileName)
at CellsDotnet6.Program.Main(String[] arg) in /src/Program.cs:line 60
I tried without Docker, building simply on Linux: same problem with the p:PublishReadyToRun
options.
The Aspose.Cells.dll
in the working version is 13,911,312 bytes, whereas in the non-working PublishReadyToRun
one, the Aspose.Cells.dll
is 42,178,560 bytes (which is to be expected). But it should not cause it to fail.
The System.Drawing.Common
file is also different (working: 372,840 bytes vs non-working 857,600 bytes).
That may bring us back to the System.Drawing.Common is windows-only on .NET 6 “issue”… ?