c# AsyncCallBack and COM+

  • Thread starter Thread starter Rick Close
  • Start date Start date
R

Rick Close

We are developing a C# application using .Net
AsyncCallback delegates. The application currently
executes, as expected,
using these asynchronous methods. Once this application is
converted to a COM+ component (i.e. a .NET serviced
component) the program ceases to execute properly
and 'hangs' without asynchronously executing the callback
delegates. Any help with .Net asynchronous programming
under COM+ would be grealty appreciated.
 
Rick,

You are not going to be able to do this. Switching threads in a context
(which is what you are doing), and then trying to access things outside of
the context are big no-nos. It is ok if you are accessing internal
information in the context, as you are responsible for it at that point, but
once you are trying to access other things that the context provides (for
example, transactioning services, etc, etc), COM+ doesn't know how to track
those threads.

You should marshal the calls back through the calling thread if you want
this to work.

Hope this helps.
 
Nicholas said:
Rick,

You are not going to be able to do this. Switching threads in a context
(which is what you are doing), and then trying to access things outside of
the context are big no-nos. It is ok if you are accessing internal
information in the context, as you are responsible for it at that point, but
once you are trying to access other things that the context provides (for
example, transactioning services, etc, etc), COM+ doesn't know how to track
those threads.

You should marshal the calls back through the calling thread if you want
this to work.

Hope this helps.

Or, you probably should be looking at the COM+ way of doing async calls.
I dont like it particularly though.

Or better still, take a peek at MSMQ stuff. That should help out.
 
Back
Top