87 references to ApartmentState
mscorlib (19)
system\applicationactivator.cs (8)
32private ApartmentState m_apt; 59m_apt = ApartmentState.Unknown; 95if (checkAptModel && m_apt != ApartmentState.Unknown) { 96if (Thread.CurrentThread.GetApartmentState() != ApartmentState.Unknown && Thread.CurrentThread.GetApartmentState() != m_apt) 107m_apt = ApartmentState.STA; 110if (m_apt == ApartmentState.Unknown) 111m_apt = ApartmentState.MTA; 113m_apt = ApartmentState.Unknown;
system\threading\thread.cs (11)
952public ApartmentState ApartmentState 957return (ApartmentState)GetApartmentStateNative(); 969public ApartmentState GetApartmentState() 971return (ApartmentState)GetApartmentStateNative(); 976public bool TrySetApartmentState(ApartmentState state) 983public void SetApartmentState(ApartmentState state) 991private bool SetApartmentStateHelper(ApartmentState state, bool fireMDAOnMismatch) 993ApartmentState retState = (ApartmentState)SetApartmentStateNative((int)state, fireMDAOnMismatch); 999if ((state == System.Threading.ApartmentState.Unknown) && (retState == System.Threading.ApartmentState.MTA))
PresentationCore (14)
Core\CSharp\System\Windows\Input\InputManager.cs (1)
181if(Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
Core\CSharp\System\Windows\Input\InputProcessorProfiles.cs (1)
78Debug.Assert(Thread.CurrentThread.GetApartmentState() == ApartmentState.STA, "Initialize called on MTA thread!");
Core\CSharp\System\Windows\Input\InputProcessorProfilesLoader.cs (1)
74Debug.Assert(Thread.CurrentThread.GetApartmentState() == ApartmentState.STA, "Load called on MTA thread!");
Core\CSharp\System\Windows\Input\TextServicesContext.cs (1)
63Debug.Assert(Thread.CurrentThread.GetApartmentState() == ApartmentState.STA, "SetDispatcherThreaad on MTA thread");
Core\CSharp\System\Windows\Media\Effects\BitmapEffect.cs (1)
65if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
Core\CSharp\System\Windows\OleServicesContext.cs (9)
122if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 141if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 160if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 181if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 200if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 234if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 251if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 277if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 307if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
PresentationFramework (8)
src\Framework\MS\Internal\AppModel\XappLauncher.cs (1)
535thread.SetApartmentState(ApartmentState.STA);
src\Framework\System\Windows\Documents\TextServicesHost.cs (1)
81Debug.Assert(Thread.CurrentThread.GetApartmentState() == ApartmentState.STA, "OnRegisterTextStore must be called on STA thread");
src\Framework\System\Windows\Interop\ActiveXHost.cs (1)
113if (Thread.CurrentThread.ApartmentState != ApartmentState.STA)
src\Framework\System\Windows\Interop\BrowserInteropHelper.cs (1)
93Verify.IsApartmentState(ApartmentState.STA);
src\Framework\System\Windows\Interop\DocobjHost.cs (1)
85Debug.Assert(_mainThread.ApartmentState == ApartmentState.STA);
src\Framework\System\Windows\Shell\JumpList.cs (1)
562Verify.IsApartmentState(ApartmentState.STA);
src\Framework\System\Windows\Standard\Debug.cs (1)
338public static void IsApartmentState(ApartmentState expectedState)
src\Framework\System\Windows\Standard\Verify.cs (1)
39public static void IsApartmentState(ApartmentState requiredState, string message)
System (4)
compmod\microsoft\win32\SystemEvents.cs (1)
572if (!UserInteractive || Thread.CurrentThread.GetApartmentState() == ApartmentState.STA) {
services\monitoring\system\diagnosticts\Process.cs (2)
2855if( Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) { 2858executionThread.SetApartmentState(ApartmentState.STA);
sys\system\collections\concurrent\BlockingCollection.cs (1)
1765return Thread.CurrentThread.GetApartmentState() == ApartmentState.STA;
System.Data (2)
fx\src\data\System\Data\OleDb\OleDbConnectionInternal.cs (2)
687if (ApartmentState.Unknown == Thread.CurrentThread.GetApartmentState()) { 697Thread.CurrentThread.SetApartmentState(ApartmentState.MTA);
System.Management (15)
Instrumentation\EventSource.cs (1)
343thread.SetApartmentState(ApartmentState.MTA);
Instrumentation\Instrumentation.cs (1)
497cleanupThread.SetApartmentState(ApartmentState.MTA);
InteropClasses\WMIInterop.cs (13)
1986thread.SetApartmentState(ApartmentState.MTA); 2100if(Thread.CurrentThread.GetApartmentState() != ApartmentState.MTA) 2191private ApartmentState apartmentType ; // Apartment type of thread 2252public ApartmentState ApartmentType 2298InitializeThreadState ( null, workerMethod, ApartmentState.MTA, false ) ; 2311InitializeThreadState ( null, workerMethod, ApartmentState.MTA, false ) ; 2324InitializeThreadState ( null, workerMethod, ApartmentState.MTA, false ) ; 2337InitializeThreadState ( null, workerMethod, ApartmentState.MTA, false ) ; 2371this.apartmentType = ApartmentState.MTA ; 2380private void InitializeThreadState ( object threadParams, ThreadWorkerMethodWithReturn workerMethod, ApartmentState aptState, bool background ) 2395private void InitializeThreadState ( object threadParams, ThreadWorkerMethodWithReturnAndParam workerMethod, ApartmentState aptState, bool background ) 2410private void InitializeThreadState ( object threadParams, ThreadWorkerMethod workerMethod, ApartmentState aptState, bool background ) 2425private void InitializeThreadState ( object threadParams, ThreadWorkerMethodWithParam workerMethod, ApartmentState aptState, bool background )
System.ServiceModel (2)
System\ServiceModel\Administration\WbemProvider.cs (2)
1059if (Thread.CurrentThread.GetApartmentState() != ApartmentState.MTA) 1064thread.SetApartmentState(ApartmentState.MTA);
System.Windows.Forms (18)
winforms\Managed\System\WinForms\Application.cs (4)
1336public static System.Threading.ApartmentState OleRequired() { 3178internal System.Threading.ApartmentState OleRequired() { 3207return System.Threading.ApartmentState.MTA; 3210return System.Threading.ApartmentState.STA;
winforms\Managed\System\WinForms\AxHost.cs (2)
285if (Application.OleRequired() != ApartmentState.STA) { 3641if (Application.OleRequired() != System.Threading.ApartmentState.STA) {
winforms\Managed\System\WinForms\Clipboard.cs (2)
111if (Application.OleRequired() != System.Threading.ApartmentState.STA) { 218if (Application.OleRequired() != System.Threading.ApartmentState.STA) {
winforms\Managed\System\WinForms\ComboBox.cs (2)
201if (Application.OleRequired() != System.Threading.ApartmentState.STA) { 249if (Application.OleRequired() != System.Threading.ApartmentState.STA) {
winforms\Managed\System\WinForms\Control.cs (1)
11238if (Application.OleRequired() != System.Threading.ApartmentState.STA) {
winforms\Managed\System\WinForms\FileDialog.cs (1)
982if (Control.CheckForIllegalCrossThreadCalls && Application.OleRequired() != System.Threading.ApartmentState.STA) {
winforms\Managed\System\WinForms\FolderBrowserDialog.cs (1)
257if (Control.CheckForIllegalCrossThreadCalls && Application.OleRequired() != System.Threading.ApartmentState.STA)
winforms\Managed\System\WinForms\Printing\PrintControllerWithStatusDialog.cs (1)
170thread.SetApartmentState(ApartmentState.STA);
winforms\Managed\System\WinForms\ToolStripDropTargetManager.cs (1)
252if (Application.OleRequired() != System.Threading.ApartmentState.STA)
winforms\Managed\System\WinForms\TrustManager.cs (1)
1078thread.SetApartmentState(System.Threading.ApartmentState.STA);
winforms\Managed\System\WinForms\WebBrowserBase.cs (2)
108if (Application.OleRequired() != ApartmentState.STA) { 1361if (Application.OleRequired() != System.Threading.ApartmentState.STA) {
System.Workflow.Runtime (2)
DebugEngine\ProgramPublisher.cs (2)
50publisherThread.SetApartmentState(ApartmentState.MTA); 93unpublisherThread.SetApartmentState(ApartmentState.MTA);
WindowsBase (3)
Base\MS\Internal\Verify.cs (1)
33public static void IsApartmentState(ApartmentState requiredState)
Base\System\Windows\Threading\Dispatcher.cs (1)
2429if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)
Shared\MS\Internal\TextServicesLoader.cs (1)
111Invariant.Assert(Thread.CurrentThread.GetApartmentState() == ApartmentState.STA, "Load called on MTA thread!");