I have written a c# RTD server based off of Kenny Ker's Multiple Topics in C#
The main difference between his design and mine is that my data comes from a WCF client. I use the same type of timer and every couple of seconds I call
while ( Marshal.ReleaseComObject( m_callback ) > 0 ) ;
m_callback = null;
GC.WaitForPendingFinalizers(); //SEHException thrown from this
The question was fairly vague, but that's because I really had no idea where to start. Every thing seemed to be working correctly.
After playing around with the code I noticed that I had an object that implemented IDisposable that I called Dispose on when I was done with it. The object also had a finalizer that called Dispose. I changed it to be more like this with a protected
I also removed the Excel assembly per Kenny Ker again (however just copying his code didn't work. I actually copied the interfaces straight from the excel interop assembly).
After doing that I was able to get rid of the lines I added (for marshalling the garbage collecting) above and excel now closes without a problem.