UDF calculating many times

Jul 15, 2014 at 3:37 PM
Edited Jul 15, 2014 at 3:38 PM
I use .NET 4.5.1, excelDNA 0.32, Netoffice
MyUDF is defined as below.
I notice a strange behavior
On one spreadsheet, I have so many (100+) MyUDF,
When I press F2+Enter on one cell, I expect only the cell get re-calculated but I see all cells with MyUDF get re-calculated! And each cell is calculated many times !

public static object MyUDF(string symbol, string column, object onDate, string fillOpt, string frequency)
{
string key =  symbol + column + onDate + fillOpt + frequency + "_datapoint";
return ExcelAsyncUtil.Run("MyUDF", new object[] {symbol, column, onDate, fillOpt, frequency},
       delegate
       {


                    object datapoint;  //if the value exists in cache, return it, otherwise will call web service
                    if (CachedDataPoints.ContainsKey(key))
                    {
                        datapoint = CachedDataPoints[key];
                    }
                    else
                    {
                        datapoint = Container.Resolve<IMyWebService>().GetDataPointSync(symbol, column, onDate, fillOpt, frequency);
                        if (String.IsNullOrEmpty(datapoint.ToString())) datapoint = "NA";
                        //put value in cache so next time we can get it directly from cache instead of calling web service                                    
                         CachedDataPoints.Add(key, datapoint);
                    }
                    return datapoint;
       });
}