Excel DNA RTD disconnect

391 views
Skip to first unread message

Tamás Kiss

unread,
Oct 6, 2014, 12:16:49 PM10/6/14
to exce...@googlegroups.com
Hi,

We seen the following problem with our addin which expose RTD function. Some users (seems to be totally random) after a while just disconnected/ has broken RTD subscription without any prior error. We currently use Excel 2010 on all machine.
We run our addin on 20 computer running all of them the same sheet, the error come up 1x in every couple of days. Seems to be excel totally stops doing anything, as we have another checking thread which check how many subscription has and it doesn't even run.



Example code we using:

[ExcelFunction(Name = "GetData", Category = "M", IsVolatile = false, IsMacroType = true,
     Description = "Get live data")]
public static object[,] GetData([ExcelArgument(AllowReference = false, Name = "Instrument", Description = "Instrument")]string product,
            [ExcelArgument(AllowReference = false, Name = "Strip", Description = "Strip or strips to synchronize (optional)")]object strip)

{
object result = XlCall.Excel(XlCall.xlfRtd, DataRTDProgId, null, product, strip);
return new object[,] { { result } 
};

And we have standard RTD server registered by:
ComServer.DllRegisterServer();

call dynamically at AutoOpen. 


The RTD server received DisconnectData for all of it's subscription in this case from excel/exceldna.


If you would have any suggestion which way we we should start that would be great.


Tamas

Govert van Drimmelen

unread,
Oct 6, 2014, 5:01:34 PM10/6/14
to exce...@googlegroups.com

Hi Tamas,

 

From your code I see you are making the RTD calls directly, via the xlfRtd function and using ComServer.DllRegisterServer() to register the RTD COM server.

 

I presume you’ve made the RTD server by implementing IRtdServer yourself.

If so, you have to be really careful with the RefreshData callbacks to Excel. They have to always run on the main Excel thread. In addition, and unhandled exceptions you have in any of the IRtdServer functions would be a problem to Excel (though I’d expect Excel to crash in these cases.)

 

I’d then recommend you try to move the RTD server to using the ExcelRtdServer base class in Excel-DNA. That’s more careful with the updates back to Excel.

 

If you’re not using the RTD server from the sheet directly with =RTD(…) functions, you might also simplify things by calling via the Excel-DNA just-in-time registration. For this you replace XlCall.Excel(XlCall.xlfRtd, …) with XlCall.RTD(…).

Then you can get rid of the persistent ComServer.DllRegisterServer() call.

 

Otherwise, I can’t think of users users having reported similar problems, so I expect it to be related  your RTD server implementation. But I don’t know whether other users are using it in long-running setting, though I’d guess there were some.

 

-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 post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

Tamás Kiss

unread,
Oct 8, 2014, 10:44:24 AM10/8/14
to exce...@googlegroups.com
Hi Govert,

The strange thing about this we only have 1 users a week who experience this issue, but all of them running exactly the same spread sheet with the same add-in. We roughly have 15 user running the same set-up 10-14 hours a day.

I will have a look and see how feasible for us to port our code to use the in-built RTD server in ExcelDna.

Thanks for your suggestions!

Tamas
Reply all
Reply to author
Forward
0 new messages