Exception when registering function

29 views
Skip to first unread message

dennis.p...@gmail.com

unread,
Dec 13, 2021, 8:59:39 AM12/13/21
to Excel-DNA
Hi,

I get an error at this point after building the addin. The function ist called in the autoopen function:
exception.jpg

The reason seems to be this function:

                [ExcelFunction(Description = "Provides a stream fed from database polls")]
                public static IObservable<object> xldnaRtdNamedDatabasePoll(string _name, int teiler)
                {
                        IObservable<object> result = LazyPolling.getLazyPolling(_name);
                        return result;
                }

If I delete this function, everythiong is working fine.

Is there a problem using the IObservableObject as return value for this function?

It is similare to the RTDServerCLock example.

Kind regards,

Dennis

Govert van Drimmelen

unread,
Dec 13, 2021, 5:30:29 PM12/13/21
to Excel-DNA
--------------------------------------------------
Excel-DNA is now registered on GitHub Sponsors.
Your monthly contribution helps the project thrive.
--------------------------------------------------

Hi Dennis,

It's certainly not a friendly error to get in this case.

For the IObservable<T> mapping to work through the Registration extension, you need to to call ProcessAsyncRegistrations() on the function list.

The RtdClocks example  that you need to look at is called "RtdClock_Rx_Regisration". In the AutoOpen it does the registration like this:

            ExcelRegistration.GetExcelFunctions()
                             .ProcessAsyncRegistrations()
                             .RegisterFunctions();

You might add your own re-write step in between.

Let me know if that still doesn't work.

-Govert

dennis.p...@gmail.com

unread,
Dec 14, 2021, 4:57:13 AM12/14/21
to Excel-DNA
Thank you! Now it is working perfectly! 
Reply all
Reply to author
Forward
0 new messages