We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

.NET 6 and PublishReadyToRun Failure

I am migrating from .NET 5 to .NET 6. The application is Published as a Self-Contained Windows application with the command: dotnet publish --configuration Release --output bin\publish --self-contained --runtime win-x64

Running the published application results in exceptions in the SetLicense call. Version 20.4.0 throws a NullReferenceException. Newer throw a variety of other exceptions which just do not happen when either debugging or otherwise running the compiled application (or published without PublishReadToRun true).

When reverted back to .NET 5 with PublishReadyToRun true there is no Exception.

I’ve looked through all of the changelogs and didn’t notice any related fixes. Is this a known issue? Is there a workaround?

@ejohnsonlrs

Could you please try the latest version of Aspose.Email for .NET 21.12? If you still face problem, please attach the following resources here for testing:

  • Your input file if you are using any.
  • Please share all steps that you are using to reproduce the same issue at our end.
  • Please create a sample application (source code without compilation errors) and attach it here for testing. Please remove all DLLs from your application to reduce the application size.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

With 21.12, and PublishReadyToRun true, LoadLicense() is throwing FileLoadException:

System.IO.FileLoadException: Could not load file or assembly ‘Aspose.Email, Version=21.12.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’. The located assembly’s manifest definition does not match the assembly reference. (0x80131040)
File name: ‘Aspose.Email, Version=21.12.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’
at Program.$(String[] args)

With PublishReadyToRun false, I get the expected failure about my license key being expired (not valid for 21.12).

I have attached a sample. Please note that I have removed the contents of the embedded resource license file. The code doesn’t actually get that far with PublishReadyToRun true, but you can easily drop in a new license file.

To reproduce: from the project directory, powershell:

del .\bin\publish\*.*
dotnet publish --configuration Release --output bin\publish --self-contained --runtime win-x64
.\bin\publish\LicenseTest.exe

Thanks!

LicenseTest.zip (13.1 KB)

@ejohnsonlrs

We have managed to reproduce the same issue at our side. For the sake of correction, we have logged it in our issue tracking system as EMAILNET-40516. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.