apartments

Could you explain STA and MTA?

I'm having trouble understanding STA and MTA. If you could explain it in your own words that would be great. Also what are Apartment threads and do they pertain only to COM? If so why? ...

What does the term "input-synchronized calls" mean?

I found this in an article on Multithreaded Apartments, but can’t find a definition for “input-synchronized calls”. (Article is at http://msdn.microsoft.com/en-us/library/ms693421(VS.85).aspx) As used in the article - Multithreaded apartments cannot make input-synchronized calls What are “input-synchronized" calls? Thanks ...

C#: WebBrowser.Navigated Only Fires when I MessageBox.Show();

I have a WebBrowser control which is being instantiated dynamically from a background STA thread because the parent thread is a BackgroundWorker and has lots of other things to do. The problem is that the Navigated event never fires, unless I pop a MessageBox.Show() in the method that told it to .Navigate(). I shall explain: ThreadSt...

Single-Threaded Apartments vs Multi-Threaded Apartments

All ThreadPool threads are in the multithreaded apartment. --As per the MSDN What does that mean? I am really concerned with what the difference between the multi vs single threaded apartment model is. Or what does the apartment model mean? I have read the MSDN on it, and it doesn't really make sense to me. I think I may have an ...

Asynchronous operations within an asynchronous operation

My multi-threading knowledge is still pretty rudimentary, so would really appreciate some pointers here. I have an interface, IOperationInvoker (from WCF) which has the following methods: IAsyncResult InvokeBegin(object instance, object[] inputs, AsyncCallback callback, object state) object InvokeEnd(object instance, out object[] output...

Legacy VB6 COM+ DLL calling into native Win32 DLL -- threading issues with STA?

Hi all, Come across what looks at first sight like an MT-issue, but I'm trying to understand in detail the STA model used by COM+. Effectively, I have a legacy COM+ component, written in VB6, that calls into a native (i.e., not-COM) Win32 DLL written in C++. Having some intermittant (and impossible to reproduce in testing) problems wi...

Using Clipboard.GetDataObject() from a .Net worker thread.

Hi; To invoke Clipboard.GetDataObject(), your thread must be running in a single thread appartement (STA). My application uses a lot of asynchronous operation (Begin/End). The completion methods for those operations are called in a worker MTA thread. Once a thread starts running, I can't modify its thread appartement. What are the opt...

How to make Quartz.net job to run in a single-threaded apartment?

I simply tried this: public class FooJob : IJob { public FooJob() { } public void Execute(JobExecutionContext context) { Thread.CurrentThread.SetApartmentState(ApartmentState.STA); } } But it produces InvalidOperationException. Ideas? ...

Thread.Join in a shared hosting environment

Hi, I wonder if someone can help me - I've been programming VB.Net for a long time but have rarely had to do much threading in ASP.Net. I'm attempting to take "screenshots" of websites using an in-memory browser. These images are then logged in a DB and written to the local file system. When I run it on my local server, it all works f...

TimerCallback Delegate to drive an STA model .NET library component

I'm trying to use the TimerCallback Delegate mechanism to drive instances of objects from a 3rd party .NET library component on separate threads executing on a timed basis. When I try to create an instance of an object from the library I an exception is raised: (object name) can only be called from a single-threaded apartment (STA...