Running RefreshDynamicArrayFormulas on workbook clears UDF calculated values

PFA workbook.

Example code:

    public class UdfManager : AbstractCalculationEngine
    {
        public override void Calculate(CalculationData data)
        {
            if (data.FunctionName.Equals("DCRefersToSheetName"))
            {
                data.CalculatedValue = "Inputs";
            }
        }
    }

    static void Main(string[] args)
    {
        var workbook = new Workbook(@"udfs.xlsx");

        var manager = new UdfManager();
        var options = new CalculationOptions
        {
            IgnoreError = true,
            PrecisionStrategy = CalculationPrecisionStrategy.Decimal,
            CustomEngine = manager

        };

        var sheet = workbook.Worksheets["hides"];

        workbook.CalculateFormula(options);

        var beforeA2 = sheet.Cells["A2"].Value;
        var beforeB5 = sheet.Cells["B5"].Value;

        workbook.RefreshDynamicArrayFormulas(true);

        var afterA2 = sheet.Cells["A2"].Value;
        var afterB5 = sheet.Cells["B5"].Value;
    }

udfs.zip (11.8 KB)

@Moonglum
Please try the following sample code:

var workbook = new Workbook(filePath + @"udfs.xlsx");

var manager = new UdfManager();
var options = new CalculationOptions
{
    IgnoreError = true,
    PrecisionStrategy = CalculationPrecisionStrategy.Decimal,
    CustomEngine = manager

};

var sheet = workbook.Worksheets["hides"];

var beforeA2 = sheet.Cells["A2"].Value;
var beforeB5 = sheet.Cells["B5"].Value;
Console.WriteLine(beforeA2 + "  " + beforeB5);

workbook.RefreshDynamicArrayFormulas(true);
workbook.CalculateFormula(options); 
            

var afterA2 = sheet.Cells["A2"].Value;
var afterB5 = sheet.Cells["B5"].Value;
Console.WriteLine(afterA2 + "  " + afterB5);


public class UdfManager : AbstractCalculationEngine
{
    public override void Calculate(CalculationData data)
    {
        if (data.FunctionName.Equals("DCRefersToSheetName"))
        {
            data.CalculatedValue = "Inputs";
        }
    }
}

Hope helps a bit.