ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RTD Bug? or perhaps a feature? (https://www.excelbanter.com/excel-programming/324320-rtd-bug-perhaps-feature.html)

Another frustrated developer

RTD Bug? or perhaps a feature?
 
I have implemented a wonderful RTD Server in c# that works like a dream.

However, After you open Excel, enter the RTD formula (You then get the
MSCoree.dll contains macros prompt - to which you answer yes) and get a
result. If you then close the workbook, so that Excel has no book open, and
then start a new workbook and type the same formula in you just get #N/A ???

I cannot for the life of me work out why. The only way to get the RTD
formulae working again is to close Excel and open it again.

Any Ideas anyone??

Jim Thomlinson[_3_]

RTD Bug? or perhaps a feature?
 
How exactly are you attaching to your DLL file? It sounds as if you are
losing the link so it would be good to know how you are attaching in the
first place.

"Another frustrated developer" wrote:

I have implemented a wonderful RTD Server in c# that works like a dream.

However, After you open Excel, enter the RTD formula (You then get the
MSCoree.dll contains macros prompt - to which you answer yes) and get a
result. If you then close the workbook, so that Excel has no book open, and
then start a new workbook and type the same formula in you just get #N/A ???

I cannot for the life of me work out why. The only way to get the RTD
formulae working again is to close Excel and open it again.

Any Ideas anyone??


Another frustrated developer

RTD Bug? or perhaps a feature?
 
The c# DLL is registered locally with COM interop and is then instantiated
through the following Excel Formula :

=RTD("Pioneer.RTD",,"LongName",1)

Pioneer.RTD being the namespace.classname and LongName being the requred
function and 1 being the parameter.

I have investigated further and the "odd" behaviour occurs anytime that
excel moves out of a state where it has a workbook open that references (or
has referenced) the RTD dll, into a state where it has no workbook open that
has used the RTD dll. ie. you do not need to go into a "no workbooks open"
state to emulate this.

This is odd.

"Jim Thomlinson" wrote:

How exactly are you attaching to your DLL file? It sounds as if you are
losing the link so it would be good to know how you are attaching in the
first place.

"Another frustrated developer" wrote:

I have implemented a wonderful RTD Server in c# that works like a dream.

However, After you open Excel, enter the RTD formula (You then get the
MSCoree.dll contains macros prompt - to which you answer yes) and get a
result. If you then close the workbook, so that Excel has no book open, and
then start a new workbook and type the same formula in you just get #N/A ???

I cannot for the life of me work out why. The only way to get the RTD
formulae working again is to close Excel and open it again.

Any Ideas anyone??


Another frustrated developer

RTD Bug? or perhaps a feature?
 
Jim, worry not, my error.

My RTD uses Remoting to pass groups of queries back to the server. A little
bit of debugging and I've realised that the constructor was bombing second
time through when it tried to configure the remoting channel.

Thanks anyway.

Another frustrated developer

RTD Bug? or perhaps a feature?
 
Interesting....

It seems that Excel, although calling Server Terminate on the original DLL,
never lets go of it's reference to it, even after all workbooks are closed.

If a new Workbook is created it instantiates a new instance of the DLL and
places it's calls to this, when this workbook is closed it calls Server
Terminate and stops referencing the DLL (I can see the destructor being
called). But the original DLL reference lives on.

The only time it lets go is when the Excel Application is closed.

The reason this matters is that my local RTD server dll uses remoting to
call to the server and get it's data. In the RTD dll constructor I set up
the remoting configuration. If a second RTD dll object then tries to set up
the same configuration a RemotingException is thrown. I can catch this, and
just assume remoting is set up already, but if the original class ever gets
disposed of then the second will not be able to create remote calls.






Jens Thiel[_2_]

RTD Bug? or perhaps a feature?
 
"Another frustrated developer"
. com wrote in message
...
Interesting....

It seems that Excel, although calling Server Terminate on the original

DLL,
never lets go of it's reference to it, even after all workbooks are

closed.
[...]


My guess is that you have references in managed code which haven't been
garbage collected yet.

Jens.

--
http://ManagedXLL.net/
Replace MSDN with my first name when replying to my email address!



Another frustrated developer

RTD Bug? or perhaps a feature?
 
A nice guess, and one that I entertained, however it falls down on
explaining why only the first instance does not get destroyed but all
subsequent instances do. I set all references to null and explicitly place a
call to GC.Collect in the ServerTerminate method.

Guess again.

"Jens Thiel" wrote:

"Another frustrated developer"
. com wrote in message
...
Interesting....

It seems that Excel, although calling Server Terminate on the original

DLL,
never lets go of it's reference to it, even after all workbooks are

closed.
[...]


My guess is that you have references in managed code which haven't been
garbage collected yet.

Jens.

--
http://ManagedXLL.net/
Replace MSDN with my first name when replying to my email address!





All times are GMT +1. The time now is 07:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com