Nested asynchronous functions

213 views
Skip to first unread message

Yurii Razvalinov

unread,
Sep 9, 2015, 2:35:28 PM9/9/15
to Excel-DNA
Hi, I have simple async function

        public static object Sleep(int number)
       
{
           
object callerParameters = new object[] { number };
           
return ExcelAsyncUtil.Run("Sleep", callerParameters, () =>
           
{
               
Thread.Sleep(1000);
               
return number;
           
});
       
}

and when I run it in Excel like

=Sleep(Sleep(10)+1)

It falls into an infinite loop with alternating values #N/A and #VALUE!

Is there a way to get to work nested functions?

I have tried on versions 0.32 and 0.33 with the same result.

Govert van Drimmelen

unread,
Sep 9, 2015, 2:57:03 PM9/9/15
to Excel-DNA
Hi Yurii,

I don't know of a way around that problem with the RTD-based async implementation.

For Excel 2010+ you might try the native Excel async functions, but the semantics is quite different.

-Govert
Reply all
Reply to author
Forward
0 new messages