I have written code to check cell formula of excel cell in C# ClosedXML. Everything works fine, but only problem is, if the checked cell formula contains self cell then it gives StackOverflowException. Can anyone please tell how to handle StackOverflowException in that case? Refer below code:
var xlWorkBook= new ClosedXML.Excel.XLWorkbook(fileStream);
var workSheet = xlWorkBook.Worksheet(1);
var row = workSheet.Row(2);
string cellValue = row.Cell(2).Value.ToString().Trim();