288 references to CurrentThread
Aspire.Dashboard.Components.Tests (7)
UseCultureAttribute.cs (7)
11/// <see cref="Thread.CurrentThread" /> <see cref="CultureInfo.CurrentCulture" /> and 68_originalCulture = Thread.CurrentThread.CurrentCulture; 69_originalUICulture = Thread.CurrentThread.CurrentUICulture; 71Thread.CurrentThread.CurrentCulture = Culture; 72Thread.CurrentThread.CurrentUICulture = UICulture; 86Thread.CurrentThread.CurrentCulture = _originalCulture!; 87Thread.CurrentThread.CurrentUICulture = _originalUICulture!;
Aspire.Hosting.Tests (12)
Utils\UseCultureAttributeTests.cs (12)
71var originalCulture = Thread.CurrentThread.CurrentCulture; 76Assert.Equal(attr.Culture, Thread.CurrentThread.CurrentCulture); 80Assert.Equal(originalCulture, Thread.CurrentThread.CurrentCulture); 89var originalUICulture = Thread.CurrentThread.CurrentUICulture; 94Assert.Equal(attr.UICulture, Thread.CurrentThread.CurrentUICulture); 98Assert.Equal(originalUICulture, Thread.CurrentThread.CurrentUICulture); 104Assert.Equal("sv-SE", Thread.CurrentThread.CurrentCulture.Name); 110Assert.Equal("es-CL", Thread.CurrentThread.CurrentUICulture.Name); 119var originalCulture = Thread.CurrentThread.CurrentCulture; 124var ri = new RegionInfo(Thread.CurrentThread.CurrentCulture.LCID); 126Assert.Equal(attr.Culture, Thread.CurrentThread.CurrentCulture); 131Assert.Equal(originalCulture, Thread.CurrentThread.CurrentCulture);
Aspire.TestUtilities (8)
UseCultureAttribute.cs (7)
14/// <see cref="Thread.CurrentThread" /> <see cref="CultureInfo.CurrentCulture" /> and 64_originalCulture = Thread.CurrentThread.CurrentCulture; 65_originalUICulture = Thread.CurrentThread.CurrentUICulture; 70Thread.CurrentThread.CurrentCulture = Culture; 71Thread.CurrentThread.CurrentUICulture = UICulture; 88Thread.CurrentThread.CurrentCulture = _originalCulture; 93Thread.CurrentThread.CurrentUICulture = _originalUICulture;
UseDefaultXunitCultureAttribute.cs (1)
9/// Apply this attribute to your test method to replace the <see cref="Thread.CurrentThread" />
Binding.Http.IntegrationTests (2)
OperationContextTests.cs (2)
48int currentThreadId = Thread.CurrentThread.ManagedThreadId; 50Assert.NotEqual(currentThreadId, Thread.CurrentThread.ManagedThreadId);
Binding.Tcp.IntegrationTests (8)
OperationContextAsyncFlowTests.cs (8)
35int currentThreadId = Thread.CurrentThread.ManagedThreadId; 37Assert.NotEqual(currentThreadId, Thread.CurrentThread.ManagedThreadId); 70int currentThreadId = Thread.CurrentThread.ManagedThreadId; 72Assert.NotEqual(currentThreadId, Thread.CurrentThread.ManagedThreadId); 78currentThreadId = Thread.CurrentThread.ManagedThreadId; 80Assert.NotEqual(currentThreadId, Thread.CurrentThread.ManagedThreadId); 161int currentThreadId = Thread.CurrentThread.ManagedThreadId; 163Assert.NotEqual(currentThreadId, Thread.CurrentThread.ManagedThreadId);
dotnet-svcutil.xmlserializer (3)
Microsoft\Tools\ServiceModel\SvcUtil\Tool.cs (3)
96Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentUICulture.GetConsoleFallbackUICulture(); 100(System.Console.OutputEncoding.CodePage != Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage)) 102Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
GenerateDocumentationAndConfigFiles (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs (1)
20if (Thread.CurrentThread.IsThreadPoolThread)
ILCompiler.RyuJit (2)
Compiler\RyuJitCompilation.cs (2)
175CorInfoImpl corInfo = _corinfos.GetValue(Thread.CurrentThread, thread => new CorInfoImpl(this)); 190CorInfoImpl corInfo = _corinfos.GetValue(Thread.CurrentThread, thread => new CorInfoImpl(this));
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
FormatWeekHelper.cs (1)
21var calendar = Thread.CurrentThread.CurrentCulture.Calendar;
Microsoft.Build (9)
BackEnd\Components\BuildRequestEngine\BuildRequestEngine.cs (1)
1500file.WriteLine("{0}({1})-{2}: {3}", Thread.CurrentThread.Name, Environment.CurrentManagedThreadId, DateTime.UtcNow.Ticks, message);
BackEnd\Components\RequestBuilder\RequestBuilder.cs (4)
726Thread.CurrentThread.Priority = _componentHost.BuildParameters.BuildThreadPriority; 727Thread.CurrentThread.IsBackground = true; 739if (string.IsNullOrEmpty(Thread.CurrentThread.Name)) 741Thread.CurrentThread.Name = threadName;
BackEnd\Components\Scheduler\Scheduler.cs (1)
2690file.Write("{0}({1})-{2}: ", Thread.CurrentThread.Name, Environment.CurrentManagedThreadId, _schedulingData.EventTime.Ticks);
BackEnd\Node\OutOfProcServerNode.cs (2)
394Thread.CurrentThread.CurrentCulture = command.Culture; 395Thread.CurrentThread.CurrentUICulture = command.UICulture;
src\msbuild\src\Shared\NodeEndpointOutOfProcBase.cs (1)
315ErrorUtilities.VerifyThrow(_packetPump.ManagedThreadId != Thread.CurrentThread.ManagedThreadId, "Can't join on the same thread.");
Microsoft.Build.Framework (7)
BackEnd\CommunicationsUtilities.cs (1)
782writer.WriteLine($"{Thread.CurrentThread.Name} (TID {Environment.CurrentManagedThreadId}) {now,15} +{millisecondsSinceLastLog,10}ms: {message}");
BuildEventArgs.cs (1)
90threadId = System.Threading.Thread.CurrentThread.GetHashCode();
Telemetry\CrashTelemetry.cs (1)
411CrashThreadName = System.Threading.Thread.CurrentThread.Name;
Utilities\ThreadPoolExtensions.cs (4)
32Thread.CurrentThread.CurrentCulture = culture; 37Thread.CurrentThread.CurrentUICulture = uiCulture; 47Thread.CurrentThread.CurrentCulture = originalThreadCulture; 52Thread.CurrentThread.CurrentUICulture = originalThreadUICulture;
Microsoft.Build.Tasks.Core (1)
BootstrapperUtil\Util.cs (1)
77public static CultureInfo DefaultCultureInfo => System.Threading.Thread.CurrentThread.CurrentUICulture;
Microsoft.CodeAnalysis.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs (1)
20if (Thread.CurrentThread.IsThreadPoolThread)
Microsoft.CodeAnalysis.AnalyzerUtilities (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs (1)
20if (Thread.CurrentThread.IsThreadPoolThread)
Microsoft.CodeAnalysis.CodeStyle (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs (1)
20if (Thread.CurrentThread.IsThreadPoolThread)
Microsoft.CodeAnalysis.ResxSourceGenerator (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs (1)
20if (Thread.CurrentThread.IsThreadPoolThread)
Microsoft.CodeAnalysis.Workspaces (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs (1)
20if (Thread.CurrentThread.IsThreadPoolThread)
Microsoft.Data.Analysis.Tests (1)
test\Microsoft.ML.TestFramework\BaseTestClass.cs (1)
47Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Microsoft.Extensions.Diagnostics.Testing.Tests (3)
Logging\FakeLoggerTests.cs (3)
119var oldCulture = Thread.CurrentThread.CurrentCulture; 120Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fr-CA"); 140Thread.CurrentThread.CurrentCulture = oldCulture;
Microsoft.Extensions.Telemetry.Tests (1)
Enrichment\ProcessLogEnricherTests.cs (1)
63Assert.Equal(Thread.CurrentThread.ManagedThreadId.ToString(CultureInfo.InvariantCulture), enrichedState[ProcessEnricherTagNames.ThreadId]);
Microsoft.Gen.Logging.Generated.Tests (3)
LogMethodTests.cs (3)
861var oldCulture = Thread.CurrentThread.CurrentCulture; 862Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fr-CA"); 868Thread.CurrentThread.CurrentCulture = oldCulture;
Microsoft.Maui.Graphics (1)
PdfExportContext.cs (1)
22 if ("en-US".Equals(Thread.CurrentThread.CurrentCulture.Name, StringComparison.Ordinal))
Microsoft.Maui.Resizetizer (5)
AsyncTask.cs (5)
59 uiThreadId = Thread.CurrentThread.ManagedThreadId; 108 if (uiThreadId == Thread.CurrentThread.ManagedThreadId) 137 if (uiThreadId == Thread.CurrentThread.ManagedThreadId) 182 if (uiThreadId == Thread.CurrentThread.ManagedThreadId) 216 if (uiThreadId == Thread.CurrentThread.ManagedThreadId)
Microsoft.ML.AutoML.Tests (6)
TunerTests.cs (6)
393var originalCuture = Thread.CurrentThread.CurrentCulture; 395Thread.CurrentThread.CurrentCulture = usCulture; 397Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator.Should().Be("."); 409Thread.CurrentThread.CurrentCulture = frCulture; 410Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator.Should().Be(","); 421Thread.CurrentThread.CurrentCulture = originalCuture;
Microsoft.ML.CodeGenerator.Tests (3)
TrainerGeneratorTests.cs (3)
39var currentCulture = Thread.CurrentThread.CurrentCulture; 40Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE"); 45Thread.CurrentThread.CurrentCulture = currentCulture;
Microsoft.ML.IntegrationTests (1)
IntegrationTestBaseClass.cs (1)
39Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Microsoft.ML.PerformanceTests (1)
Program.cs (1)
20Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
Microsoft.ML.SearchSpace.Tests (3)
ParameterTest.cs (3)
126var originalCuture = Thread.CurrentThread.CurrentCulture; 128Thread.CurrentThread.CurrentCulture = culture; 133Thread.CurrentThread.CurrentCulture = originalCuture;
Microsoft.ML.TestFramework (1)
BaseTestClass.cs (1)
47Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Microsoft.ML.Tests (6)
TrainerEstimators\TreeEstimators.cs (3)
779var currentCulture = Thread.CurrentThread.CurrentCulture; 780Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("de-DE"); 788Thread.CurrentThread.CurrentCulture = currentCulture;
Transformers\LineParserTests.cs (3)
54var currentCulture = Thread.CurrentThread.CurrentCulture; 55Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("de-DE"); 73Thread.CurrentThread.CurrentCulture = currentCulture;
Microsoft.TestPlatform.CoreUtilities (1)
Utilities\JobQueue.cs (1)
294Thread.CurrentThread.Name = threadName;
Microsoft.VisualBasic.Core (9)
Microsoft\VisualBasic\CompilerServices\Utils.LateBinder.vb (1)
136nfi = Threading.Thread.CurrentThread.CurrentCulture.NumberFormat
Microsoft\VisualBasic\CompilerServices\Utils.vb (2)
69Return System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat 77Return System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ANSICodePage
Microsoft\VisualBasic\CompilerServices\VB6File.vb (1)
2112NegativeSign = Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NegativeSign
Microsoft\VisualBasic\DateAndTime.vb (1)
134Return Threading.Thread.CurrentThread.CurrentCulture.Calendar
Microsoft\VisualBasic\Strings.vb (4)
519Return Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToLower(Value) 528Return Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToLower(Value) 1043Return Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToUpper(Value) 1052Return Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToUpper(Value)
Microsoft.VisualBasic.Forms (6)
Microsoft\VisualBasic\ApplicationServices\ApplicationBase.vb (4)
30Return Thread.CurrentThread.CurrentCulture 74Return Thread.CurrentThread.CurrentUICulture 86Thread.CurrentThread.CurrentCulture = New Globalization.CultureInfo(cultureName) 98Thread.CurrentThread.CurrentUICulture = New Globalization.CultureInfo(cultureName)
Microsoft\VisualBasic\CompilerServices\ExceptionUtils.vb (1)
111Return String.Format(Thread.CurrentThread.CurrentCulture, resourceKey, args)
Microsoft\VisualBasic\Interaction.vb (1)
221If Thread.CurrentThread.GetApartmentState() <> ApartmentState.STA Then
Microsoft.Win32.SystemEvents (1)
Microsoft\Win32\SystemEvents.cs (1)
387throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgument, nameof(interval), interval.ToString(System.Threading.Thread.CurrentThread.CurrentCulture), "0"));
MSBuild (4)
OutOfProcTaskHostNode.cs (2)
1437Thread.CurrentThread.CurrentCulture = taskConfiguration.Culture; 1438Thread.CurrentThread.CurrentUICulture = taskConfiguration.UICulture;
src\msbuild\src\Shared\NodeEndpointOutOfProcBase.cs (1)
315ErrorUtilities.VerifyThrow(_packetPump.ManagedThreadId != Thread.CurrentThread.ManagedThreadId, "Can't join on the same thread.");
XMake.cs (1)
1942Thread thisThread = Thread.CurrentThread;
PresentationCore (16)
System\Windows\Input\InputManager.cs (1)
142if(Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
System\Windows\Input\InputMethod.cs (1)
416Dispatcher dispatcher = Dispatcher.FromThread(Thread.CurrentThread);
System\Windows\Input\InputProcessorProfiles.cs (1)
35Debug.Assert(Thread.CurrentThread.GetApartmentState() == ApartmentState.STA, "Initialize called on MTA thread!");
System\Windows\Input\InputProcessorProfilesLoader.cs (1)
56Debug.Assert(Thread.CurrentThread.GetApartmentState() == ApartmentState.STA, "Load called on MTA thread!");
System\Windows\Input\Stylus\Common\DynamicRendererThreadManager.cs (1)
307Thread.CurrentThread.Name = "DynamicRenderer";
System\Windows\Input\Stylus\Wisp\PenThreadWorker.cs (1)
1143Thread.CurrentThread.Name = "Stylus Input";
System\Windows\Input\TextServicesContext.cs (1)
46Debug.Assert(Thread.CurrentThread.GetApartmentState() == ApartmentState.STA, "SetDispatcherThreaad on MTA thread");
System\Windows\Media\Effects\BitmapEffect.cs (1)
26if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
System\Windows\Media\HostVisual.cs (3)
135Debug.Assert(target.Dispatcher.Thread == Thread.CurrentThread); 188Debug.Assert(_target.Dispatcher.Thread == Thread.CurrentThread); 321Dispatcher channelDispatcher = Dispatcher.FromThread(Thread.CurrentThread);
System\Windows\OleServicesContext.cs (5)
89if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 112if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 125if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 141if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) 172if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
PresentationFramework (24)
Microsoft\Win32\CommonDialog.cs (2)
230if (_thread != Thread.CurrentThread) 318private readonly Thread _thread = Thread.CurrentThread;
MS\Internal\Data\ClrBindingWorker.cs (2)
388if (Dispatcher.Thread == Thread.CurrentThread) 413if (Dispatcher.Thread == Thread.CurrentThread)
System\Windows\Controls\CalendarBlackoutDatesCollection.cs (2)
30this._dispatcherThread = Thread.CurrentThread; 339return Thread.CurrentThread == this._dispatcherThread;
System\Windows\Controls\SelectedDatesCollection.cs (2)
33this._dispatcherThread = Thread.CurrentThread; 469return Thread.CurrentThread == this._dispatcherThread;
System\Windows\Controls\SpellCheck.cs (1)
141new FrameworkPropertyMetadata(Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName == "de" ? SpellingReform.Postreform : SpellingReform.PreAndPostreform,
System\Windows\Controls\WebBrowser.cs (2)
291HRESULT hr = scriptObjectEx.GetIDsOfNames(ref guid, names, 1, Thread.CurrentThread.CurrentCulture.LCID, dispids); 319Thread.CurrentThread.CurrentCulture.LCID,
System\Windows\Data\BindingExpression.cs (1)
2495if (Dispatcher.Thread == Thread.CurrentThread)
System\Windows\Data\BindingExpressionBase.cs (1)
432if (Dispatcher.Thread == Thread.CurrentThread)
System\Windows\Data\BindingGroup.cs (1)
1493if (Dispatcher.Thread == Thread.CurrentThread)
System\Windows\Documents\Speller.cs (1)
50Thread.CurrentThread.CurrentCulture;
System\Windows\Documents\TextServicesHost.cs (3)
61Debug.Assert(Thread.CurrentThread.GetApartmentState() == ApartmentState.STA, "OnRegisterTextStore must be called on STA thread"); 66_thread = Thread.CurrentThread; 372if (_thread == Thread.CurrentThread || System.Environment.OSVersion.Version.Major >= 6)
System\Windows\Documents\TextStore.cs (1)
2408Invariant.Assert(Thread.CurrentThread == _textservicesHost.Dispatcher.Thread, "GrantLock called on bad thread!");
System\Windows\Documents\WinRTSpellerInterop.cs (1)
54_defaultCulture = InputLanguageManager.Current?.CurrentInputLanguage ?? Thread.CurrentThread.CurrentCulture;
System\Windows\Interop\ActiveXHost.cs (1)
83if (Thread.CurrentThread.GetApartmentState() is not ApartmentState.STA)
System\Windows\Standard\Debug.cs (1)
338if (Thread.CurrentThread.GetApartmentState() != expectedState)
System\Windows\Standard\Verify.cs (1)
40if (Thread.CurrentThread.GetApartmentState() != requiredState)
System\Windows\SystemResources.cs (1)
1302Dispatcher dispatcher = isSysColorsOrSettingsChange ? null : Dispatcher.FromThread(System.Threading.Thread.CurrentThread);
ReachFramework (7)
PrintConfig\PTProvider.cs (2)
183this._thread = Thread.CurrentThread; 556if(_thread != Thread.CurrentThread)
PrintConfig\PTUtility.cs (1)
40return _resManager.GetString(key, System.Threading.Thread.CurrentThread.CurrentUICulture);
PrintSystemExceptions\PrintSystemException.cs (4)
221System.Threading.Thread.CurrentThread.CurrentUICulture); 240System.Threading.Thread.CurrentThread.CurrentUICulture); 244exceptionMessage = String.Format(System.Threading.Thread.CurrentThread.CurrentUICulture, 250exceptionMessage = String.Format(System.Threading.Thread.CurrentThread.CurrentUICulture,
Roslyn.Diagnostics.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs (1)
20if (Thread.CurrentThread.IsThreadPoolThread)
System.Collections.Concurrent (1)
System\Collections\Concurrent\BlockingCollection.cs (1)
1664((collections.Length == 63) && (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)))
System.Data.OleDb (3)
OleDbConnectionInternal.cs (2)
750if (ApartmentState.Unknown == Thread.CurrentThread.GetApartmentState()) 762Thread.CurrentThread.SetApartmentState(ApartmentState.MTA);
System\Data\ProviderBase\DbConnectionPool.cs (1)
929Debug.Assert(!Thread.CurrentThread.IsThreadPoolThread, "This thread may block for a long time. Threadpool threads should not be used.");
System.DirectoryServices (2)
System\DirectoryServices\DirectoryEntry.cs (2)
523if (Thread.CurrentThread.GetApartmentState() == ApartmentState.Unknown) 524Thread.CurrentThread.SetApartmentState(ApartmentState.MTA);
System.DirectoryServices.AccountManagement (2)
System\DirectoryServices\AccountManagement\Context.cs (2)
97if (Thread.CurrentThread.GetApartmentState() == ApartmentState.Unknown) 98Thread.CurrentThread.SetApartmentState(ApartmentState.MTA);
System.Management (1)
System\Management\InteropClasses\WMIInterop.cs (1)
1317if (Thread.CurrentThread.GetApartmentState() != ApartmentState.MTA)
System.Private.CoreLib (77)
src\runtime\src\coreclr\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncHelpers.CoreCLR.cs (1)
275stackState->Push(CurrentThread ??= Thread.CurrentThread);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncMethodBuilderCore.cs (1)
28Thread currentThread = Thread.CurrentThread;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncProfiler.cs (1)
959AsyncThreadContextHolder contextHolder = new AsyncThreadContextHolder(context, Thread.CurrentThread);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs (1)
158ExecutionContext? currentContext = ExecutionContext.CaptureForSuspension(Thread.CurrentThread);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\PoolingAsyncValueTaskMethodBuilderT.cs (1)
157ExecutionContext? currentContext = ExecutionContext.CaptureForSuspension(Thread.CurrentThread);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\ExecutionContext.cs (19)
56ExecutionContext? executionContext = Thread.CurrentThread._executionContext; 81return Thread.CurrentThread._executionContext; 88Debug.Assert(Thread.CurrentThread == currentThread); 115Thread currentThread = Thread.CurrentThread; 130Thread currentThread = Thread.CurrentThread; 142ExecutionContext? executionContext = Thread.CurrentThread._executionContext; 171Thread currentThread = Thread.CurrentThread; 244Thread currentThread = Thread.CurrentThread; 267Debug.Assert(threadPoolThread == Thread.CurrentThread); 318Thread.CurrentThread._executionContext = executionContext; 331Debug.Assert(currentThread == Thread.CurrentThread); 367Debug.Assert(!RuntimeFeature.IsMultithreadingSupported || Thread.CurrentThread.IsThreadPoolThread); // there are no dedicated threadpool threads on runtimes where we can't start threads 368Debug.Assert(Thread.CurrentThread._executionContext == null, "ThreadPool thread not on Default ExecutionContext."); 369Debug.Assert(Thread.CurrentThread._synchronizationContext == null, "ThreadPool thread not on Default SynchronizationContext."); 467ExecutionContext? current = Thread.CurrentThread._executionContext; 481ExecutionContext? current = Thread.CurrentThread._executionContext; 545Thread.CurrentThread._executionContext = 573Debug.Assert(currentThread == Thread.CurrentThread); 584if (Thread.CurrentThread != _thread)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\LowLevelLock.cs (4)
62bool isLocked = _ownerThread == Thread.CurrentThread; 73Debug.Assert(_ownerThread == Thread.CurrentThread); 83Debug.Assert(_ownerThread != Thread.CurrentThread); 110_ownerThread = Thread.CurrentThread;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\LowLevelMonitor.cs (2)
28public bool IsLocked => _ownerThread == Thread.CurrentThread; 71_ownerThread = Thread.CurrentThread;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\NamedMutex.Unix.cs (6)
95public bool IsLockOwnedByCurrentThread => IsLockOwnedByThreadInThisProcess(Thread.CurrentThread); 151Thread.CurrentThread.WaitInfo.NamedMutexOwnershipChain.Remove(this); 251MutexTryAcquireLockResult acquireResult = processDataHeader._processData.TryAcquireLock(Thread.CurrentThread.WaitInfo, timeoutMilliseconds: 0, ref creationDeletionProcessLock); 289Thread.CurrentThread.WaitInfo.NamedMutexOwnershipChain.Remove(this); 311(uint)Thread.CurrentThread.ManagedThreadId); 435_sharedData->LockOwnerThreadId = (uint)Thread.CurrentThread.ManagedThreadId;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.Blocking.cs (2)
34if (!BlockingConfig.IsCooperativeBlockingEnabled || !Thread.CurrentThread.IsThreadPoolThread) 71Debug.Assert(Thread.CurrentThread.IsThreadPoolThread);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\SynchronizationContext.cs (2)
16public static SynchronizationContext? Current => Thread.CurrentThread._synchronizationContext; 55public static void SetSynchronizationContext(SynchronizationContext? syncContext) => Thread.CurrentThread._synchronizationContext = syncContext;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\ConcurrentExclusiveSchedulerPair.cs (1)
593if (isDefaultScheduler && taskWasPreviouslyQueued && !Thread.CurrentThread.IsThreadPoolThread)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskContinuation.cs (1)
489(TaskScheduler.InternalCurrent == m_scheduler || Thread.CurrentThread.IsThreadPoolThread);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Thread.cs (7)
81Thread thread = Thread.CurrentThread; 269if (this != CurrentThread) 309if (this != CurrentThread) 327if (this != CurrentThread) 418Debug.Assert(ThreadState.HasFlag(ThreadState.Unstarted) || this == CurrentThread); 431Debug.Assert(this == CurrentThread); 443Debug.Assert(this == CurrentThread);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (2)
1027Debug.Assert(currentThread == Thread.CurrentThread); 1089currentThread = Thread.CurrentThread;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Timer.cs (1)
720ExecutionContext.RunFromThreadPoolDispatchLoop(Thread.CurrentThread, context, s_callCallbackInContext, this);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\WaitSubsystem.HandleManager.Unix.cs (1)
22Debug.Assert(waitInfo.Thread == Thread.CurrentThread);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\WaitSubsystem.ThreadWaitInfo.Unix.cs (10)
135Debug.Assert(_thread == Thread.CurrentThread); 155Debug.Assert(_thread == Thread.CurrentThread); 180Debug.Assert(_thread == Thread.CurrentThread); 254Debug.Assert(_thread == Thread.CurrentThread); 299Debug.Assert(_thread == Thread.CurrentThread); 408if (interruptible && Thread.CurrentThread.WaitInfo.CheckAndResetPendingInterrupt_NotLocked) 420.CurrentThread 429Debug.Assert(_thread != Thread.CurrentThread); 695Debug.Assert(_waitInfo.Thread == Thread.CurrentThread); 718Debug.Assert(_waitInfo.Thread == Thread.CurrentThread);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\WaitSubsystem.Unix.cs (4)
191ThreadWaitInfo waitInfo = Thread.CurrentThread.WaitInfo; 370return waitableObject.Wait(Thread.CurrentThread.WaitInfo, timeoutMilliseconds, interruptible, prioritize); 382ThreadWaitInfo waitInfo = Thread.CurrentThread.WaitInfo; 481ThreadWaitInfo waitInfo = Thread.CurrentThread.WaitInfo;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\WaitSubsystem.WaitableObject.Unix.cs (6)
312Debug.Assert(waitInfo.Thread == Thread.CurrentThread); 363Debug.Assert(waitInfo.Thread == Thread.CurrentThread); 511Debug.Assert(waitingThread != Thread.CurrentThread); 566Debug.Assert(waitInfo.Thread != Thread.CurrentThread); 762if (IsSignaled || _ownershipInfo!.Thread != Thread.CurrentThread) 943Debug.Assert(_thread == Thread.CurrentThread);
System\Threading\Thread.NativeAot.cs (4)
211if (Thread.CurrentThread != this) 288Debug.Assert(this == CurrentThread); 296Debug.Assert(this == CurrentThread); 486Thread.CurrentThread.IsBackground = true;
System.Private.Windows.Core.TestUtilities (8)
XUnit\UseCultureAttribute.cs (7)
15/// Apply this attribute to your test method to replace the <see cref="Thread.CurrentThread" /> 74_originalCulture = Thread.CurrentThread.CurrentCulture; 75_originalUICulture = Thread.CurrentThread.CurrentUICulture; 78Thread.CurrentThread.CurrentCulture = Culture; 79Thread.CurrentThread.CurrentUICulture = UICulture; 98Thread.CurrentThread.CurrentCulture = _originalCulture; 99Thread.CurrentThread.CurrentUICulture = _originalUICulture;
XUnit\UseDefaultXunitCultureAttribute.cs (1)
9/// Apply this attribute to your test method to replace the <see cref="Thread.CurrentThread" />
System.Security.AccessControl (3)
System\Security\AccessControl\Privilege.cs (3)
35private readonly Thread currentThread = Thread.CurrentThread; 404if (!this.currentThread.Equals(Thread.CurrentThread)) 515if (!this.currentThread.Equals(Thread.CurrentThread))
System.ServiceModel.Primitives (4)
Internals\System\Runtime\IOThreadScheduler.cs (1)
477Thread.CurrentThread.Name = "IOThreadScheduler.IOCallback";
Internals\System\Runtime\TaskHelpers.cs (2)
388if (!Thread.CurrentThread.IsThreadPoolThread) 398Fx.Assert(Thread.CurrentThread.IsThreadPoolThread, "We should be running on the thread pool");
System\ServiceModel\Channels\ReliableOutputSessionChannel.cs (1)
775if (Thread.CurrentThread.IsThreadPoolThread)
System.Speech (1)
Internal\SapiInterop\SapiRecognizer.cs (1)
36if (!IsSapi53 && System.Threading.Thread.CurrentThread.GetApartmentState() == System.Threading.ApartmentState.STA)
System.Transactions.Local (6)
System\Transactions\Oletx\OletxResourceManager.cs (1)
538resourceManager.reenlistThread = Thread.CurrentThread;
System\Transactions\TransactionScope.cs (5)
521if ((_scopeThread != Thread.CurrentThread) && !AsyncFlowEnabled) 907_scopeThread = Thread.CurrentThread; 973if (_scopeThread == Thread.CurrentThread) 990if (_savedCurrentScope._scopeThread != Thread.CurrentThread) 1011if (_scopeThread != Thread.CurrentThread)
System.Windows.Forms (9)
System\Windows\Forms\Application.ComponentThreadContext.cs (1)
404_idleHandler?.Invoke(Thread.CurrentThread, EventArgs.Empty);
System\Windows\Forms\Application.cs (3)
223get => Thread.CurrentThread.CurrentCulture; 224set => Thread.CurrentThread.CurrentCulture = value; 1283=> ThreadContext.FromCurrent()._idleHandler?.Invoke(Thread.CurrentThread, e);
System\Windows\Forms\Application.LightThreadContext.cs (1)
121_idleHandler?.Invoke(Thread.CurrentThread, EventArgs.Empty);
System\Windows\Forms\Application.ThreadContext.cs (3)
238_enterModalHandler(Thread.CurrentThread, EventArgs.Empty); 425_leaveModalHandler(Thread.CurrentThread, EventArgs.Empty); 594_threadExceptionHandler(Thread.CurrentThread, new ThreadExceptionEventArgs(ex));
System\Windows\Forms\WindowsFormsSynchronizationContext.cs (1)
29DestinationThread = Thread.CurrentThread;
System.Windows.Forms.Design (1)
System\Windows\Forms\Design\MaskDescriptor.cs (1)
41public virtual CultureInfo Culture => Thread.CurrentThread.CurrentCulture;