SetLicense throws exception

Hi,

We use .Net Reactor to obfuscate and bundle our software.

This has worked fine up until Aspose.Cells 17.6.

We now receive the following exception when trying to set the license:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at  .(Type )
   at ?.(Object[] )
   at ?.(Object[] , Type[] , Type[] , Object[] )
   at ?.(Stream , String , Object[] , Type[] , Type[] , Object[] )
   at ?.(Stream , String , Object[] )
   at ?.(Stream , String , Object[] )
   at Aspose.Cells.License.SetLicense(Stream stream)

Could we have assistance please?

We also get exceptions on other methods (if we skip the SetLicense)

System.NullReferenceException: Object reference not set to an instance of an object.
   at  .(Type )
   at ?.(Object[] )
   at ?.(Object[] , Type[] , Type[] , Object[] )
   at ?.(Stream , String , Object[] , Type[] , Type[] , Object[] )
   at ?.(Stream , String , Object[] )
   at ?.(Stream , String , Object[] )
   at Aspose.Cells.Workbook.(Stream , LoadOptions , Boolean )
   at Aspose.Cells.Workbook..ctor(Stream stream)

@ServerSide527,

Thanks for providing us error trace and details.

I think .NET Reactor tool is not free, Am I right? Could we use it as evaluation version for free to reproduce the issue? Please provide us a word document containing some screenshots and description to highlight the configuration settings or other options you are using with the tool. All this will help us to evaluate your issue precisely and to reproduce the issue on our end, so, we could log it into our database for a fix.

Thank you.

Hi,

Sure I attached a minimal solution for you to test with:

Test.zip (19.5 KB)
You will have to add the Aspose dll to the debug folder (or recompile).

Here are the settings used:

image.png (16.4 KB)

I believe the MergeAssemblies setting is the one that is not working anymore. It works on Aspose versions prior to 17.6.

If you double-click on Test.exe it will create a new file called Book2.xlsx in the same directory.
If you try this with the .net reactor assembly it will crash with the above exception.
If you try it with an older version of Aspose and .net reactor it works fine.

@ServerSide527,

Thanks for the sample project and screenshot with description.

After an initial test, I am able to reproduce the issue with the generated protected executable (application) file by .NET Reactor. I guess as we did update obfuscation settings since the release of Aspose.Cells for .NET v17.6. so, your issue might be due to updated obfuscation settings.

I got to first download and install the .NET Reactor (Downloads). Now I used your sample project and opened it into VS.NET, added reference to Aspose.Cells for .NET v17.7 assembly (net4.0), compiled it and then run it, it did produce Book2.xlsx file fine. Now I did run .NET Reactor and set open the project executable (Test.exe) from “\bin\Debug” folder, then I added the Aspose.Cells.Dll file also. Furthermore, I specified all the settings/checkboxes as per the screenshot. Finally I clicked on “Protect” icon/link. This produced “Test_Secure” folder (@ “\bin\debug” folder) containing the secured Test.exe file. Now when I run this application, I got the error/exception as you described. When I run the same process again with Aspose.Cells for .NET v17.5, it does not produce any such exception.

I have logged a ticket with an id “CELLSNET-45542” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Thank you.

@ServerSide527,

Please try our latest version/fix: Aspose.Cells for .NET v17.8.1:
Aspose.Cells for .NET v17.8.1 (.NET 2.0)
Aspose.Cells for .NET v17.8.1 (.NET 4.0)

Your issue should be fixed in it.

Let us know your feedback.

Thank you.