Process terminated when calling Workbook.CalculateFormula

Hi,

When calling Workbook.CalculateFormula for the attached file the current process is terminated.
For reproducing the issue please use the attached file and the following code (note: the process is terminated before any message being displayed in the console):

var workbook = new Workbook(“30334.xlsx”);

try
{
workbook.CalculateFormula(true);
}
catch
{
Console.WriteLine(“CalculateFormula failed.”);
}

Console.WriteLine(“CalculateFormula done.”);
Console.ReadKey();


InternalID: 30334

Best regards,
Aurelian Iordache
Software Developer
IBM Romania

Hi Aurelian,


Thank you for sharing the sample spreadsheet.

We have evaluated the presented scenario while using the latest version of Aspose.Cells for .NET 8.5.2.4, and we are able to replicate the said problem. The process seems to terminate without showing any message or stopping for the Console.ReadKey. This incident has been logged as CELLSNET-43896 in our bug tracking system for further investigation. Please allow our product team to look further into the details of this problem. In the meanwhile, we will keep you posted with updates in this regard.

We are sorry for the inconvenience.

Hi,


We think the calculation for the formulas in your given template file requires deep stack chain. Please try with smaller CalculationOptions.CalcStackSize when calculating formulas to see whether it can work for you:
e.g
Sample code:

CalculationOptions co = new CalculationOptions();
co.CalcStackSize = 50;
workbook.CalculateFormula(co);

Let us know if you still have any issue.

Thank you.

Hi Amjad,

Thank you, actually with our version of Aspose.Cells (8.6.0.0) the value fixing this issue is 40.
A value greater than that is not working. We’ll avoid going lower than that as the performance impact is visible.
We had CalcStackSize set to 100 as we had some issues in the past, please see the details here:

<a href="https://forum.aspose.com/t/77315

Best regards,
Aurelian Iordache
Software Developer
IBM Romania


Hi,


Thanks for sharing your feedback and details.

I have logged your concerns against your issue “CELLSNET-43896” into our database. Our concerned developer from product team will soon evaluate and look into it.

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

Thank you.

Hi,


What’s your environment to run the application? By our tests, in a common console application, even with the CalcStackSize=200 we can calculate the workbook successfully. The required stack depth is different for calculating different formulas. The more complex formula with more references to other cells which also need to be calculated recursively, the deeper stack chain will be used and that increases the possibility of StackOverflowException. For such kind of issue, we are afraid we have no better choice to avoid the exception other than using smaller CalcStackSize.

Thank you.

Hi Amjad,

I’m attaching a screenshot containing details about the environment on my machine.
I tried to calculate the workbook starting with CalcStackSize=50 but it didn’t worked so I decreased the value by one unit at a time until the workbook calculation succeeded with CalcStackSize=40.

Regards,
Aurelian Iordache
Software Developer
IBM Romania

Hi,


Thanks for providing your environment details.

We will further evaluate your issue and get back to you soon.

Thank you.

Hi Amjad,

Just few more details - seems the calculation is succeeding with CalcStackSize greater than 40 if there is more free RAM. We tested this scenario on another machine and the calculation failed with CalcStackSize = 40 but after we stopped some processes to free more RAM on that machine it worked with CalcStackSize = 60.
And something I didn’t provided in my previous post (and seems to be relevant) - my machine where it worked with CalcStackSize = 40 have 16GB RAM.
Just a thought but maybe CalcStackSize value should be dynamic and set internally by Aspose.Cells depending on how much free RAM is available when the calculation process is starting ?..

Regards,
Aurelian Iordache
Software Developer
IBM Romania

Hi Aurelian,


Thank you for additional information. We have passed it on to the product team for further review and analysis. As soon as we receive further updates, we will post here for your kind reference.

Hi,


Thanks for your test project.

By testing your project and comparing it with other test projects, we finally find the difference which caused the StackOverflowException with smaller stack size. In the project settings, there is one option:
i.e.,
true
In Visual Studio, the option can be changed in project’s properties, for your reference, please see the attachment.

It seems, when the target is “Any CPU”, this option(Prefer32Bit) must be enabled to decrease the possibility of StackOverflowException.

Thank you.

Hi Amjad,

Thank you but actually that option is disabled in our project (please see the attached screenshot),
the demo project I’ve sent is just a simple console application with default settings designed to reproduce the issue while our actual project is a web application offering WCF services to multiple clients (desktop applications).
So the solution is not applicable in our project, we cannot change our project to a 32-bit architecture.

Best regards,
Aurelian Iordache
Software Developer
IBM Romania

Hi,


Thanks for your feedback.

We are sorry that the suggested workaround cannot be applied for your scenario/ case as you mentioned. I have logged your concerns against your issue “CELLSNET-43896” into our database. Our product team will look the details soon.

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

Thank you.

Hi Aurelian,


We have tested that if the project has the option Prefer32Bit disabled then it can cause StackOverflowException with smaller stack size. If you cannot enable this option for your main project then how about changing the target platform to x64? Please note, the scenario works fine for both x32 and x64 platforms. However, if platform is set to “Any CPU” then Prefer32Bit option has to be enabled in order to fix the aforementioned issue.

Hi,


This is to inform you that we have fixed your issue logged earlier as “CELLSNET-43896”. We will soon provide the fix after performing QA and incorporating other enhancements and fixes.

Keep in touch.

Thank you.

Hi,


Please try our latest version/fix: Aspose.Cells for .NET v8.6.3.3

Let us know your feedback.

Thank you.

The issues you have found earlier (filed as CELLSNET-43896) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.