Apose.Cells exception when used within Docker

We’re experiencing an error when using Apose.Cells v7.4.1 and AutoFitColumns method, when used in a Kubernetes Docker container. The exact error we’re seeing is:

System.NullReferenceException: Object reference not set to an instance of an object.
at Š.š.’(String , Int32 , FontStyle )
at ’’.—.š(‘’ , Int32 , RectangleF )
at ’’.—.œ(Graphics , Cells , Int32 , Int32 , Int32 , Int32 , AutoFitterOptions )
at ’’.—.AutoFitColumn(Cells , Int32 , Int32 , Int32 , Int32 , AutoFitterOptions )
at Aspose.Cells.Worksheet.AutoFitColumns()
at Test1_Aspose_Cells._7._4._1.Controllers.ValuesController.Get() in C:\Code\Work\Aspose.Cell.Excel_VersionDockerTest\Test1_Old\Test1_Aspose.Cells.7.4.1\Test1_Aspose.Cells.7.4.1\Controllers\ValuesController.cs:line 46

The following code reproduces the exception above:

try 
{
	var wb = new Workbook();
var ws = wb.Worksheets[0];
ws.Name = "Test1_Aspose_Cells._7._4._1";
var cellStrings = new string[] { "value1", "value2", "value3", "value4" };

for (int i = 0; i < cellStrings.Length - 1; i++)
{
	var cell = ws.Cells[0, 0]; //A1
	cell.PutValue($"{cellStrings[i]} - CCCCC ----- MY Long Test String  ---------------- HHHHHHHHHHHHHHHHHHHHHHHHH ----- MY Long Test String  ---------------- HHHHHHHHHHHHHHHHHHHHHHHHH ----- MY Long Test String  ---------------- HHHHHHHHHHHHHHHHHHHHHHHHH ----- MY Long Test String  ---------------- HHHHHHHHHHHHHHHHHHHHHHHHH ----- MY Long Test String  ---------------- HHHHHHHHHHHHHHHHHHHHHHHHH ----- MY Long Test String  ---------------- HHHHHHHHHHHHHHHHHHHHHHHHH");
	var style = cell.GetStyle();
	var font = style.Font;
	font.Size = 15;
	cell.SetStyle(style);
}

ws.AutoFitColumns();
ws.AutoFitRows();
wb.Save("Test1_Aspose_Cells._7._4._1.xlsx");
return true;
} 
catch 
{
return false;
}

Besides upgrading to the latest version of Cells, is there any means to get this working inside of Docker?

@AwesomeLead1,
Firstly, you should upgrade to latest version of API and if the issue still exists then share complete details of your environment for our analysis.

@ahsaniqbalsidiqui,

Thanks for your reply. Yes, we’ve experimented with a trial v20.6.0 and the issue doesn’t occur.

We’re using Azure, with a Kubernetes container. Are there any specific environment details you would need us to provide?

@AwesomeLead1,
Since the latest version of the API is compatible and you are not facing the issue anymore. We would recommend using the latest one in your environment.

@ahsaniqbalsidiqui,
Thanks for the recommendation, however we’re interested if there any patches available for the older version that would enable us to continue using it, instead of updating? This will allow us to avoid any regression concerns we have about updating Aspose.Cells, given the way we interact with it.

@AwesomeLead1,
We are afraid that updates are made in latest version of API so a patch could not be provided for older version. So updating to latest version is the solution to this issue.