Hi Tom,
Can you check with a simple function like this:
public static object GetValues()
{
return new object[,] { { 1, 2}, { "abc", "def" } };
}
I don’t expect it to be called twice.
If your function is being wrapped as an async function (so if your function is returning Task<T> and being processed by the Registration helper) then it will be called twice, even if it does no async work internally. That is a consequence of the RTD-based implementation that we use for async functions.
The first time it runs, it initiates the async call, then the async call completes, notifies Excel that the call is complete (which invalidates the calling cell(s)) and then Excel recalculates those cells, which call the function again, this time returning the value.
You can somewhat distinguish the calls by looking at the return value – it would be #N/A (ExcelError.ExcelErrorNA) for the first call, and an actual value for the second.
-Govert
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/8f35d2a7-d02d-4e11-a269-6e5d4c13aac2n%40googlegroups.com.