Skip to content

Commit 3646176

Browse files
committed
Fixed bug in Microsoft.NETCore.Native.targets + Enabled MetricsTest for WindowsThreadPool
1 parent 23ed1f2 commit 3646176

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ The .NET Foundation licenses this file to you under the MIT license.
256256

257257
<!-- The managed debugging support in libraries is unused - trim it -->
258258
<IlcArg Condition="'$(IlcKeepManagedDebuggerSupport)' != 'true'" Include="--feature:System.Diagnostics.Debugger.IsSupported=false" />
259-
<IlcArg Condition="'$(UseWindowsThreadPool)' != '' and '$(_targetOS)' == 'win' and '$(IlcKeepManagedDebuggerSupport)' == 'true'" Include="--feature:System.Diagnostics.Debugger.IsSupported=$(UseWindowsThreadPool)" />
259+
<IlcArg Condition="'$(UseWindowsThreadPool)' != '' and '$(_targetOS)' == 'win'" Include="--feature:System.Threading.ThreadPool.UseWindowsThreadPool=$(UseWindowsThreadPool)" />
260260
</ItemGroup>
261261

262262
<MakeDir Directories="$(NativeIntermediateOutputPath)" />

src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,7 @@ public void Execute() { }
436436

437437
public static bool IsMetricsTestSupported => Environment.ProcessorCount >= 3 && IsThreadingAndRemoteExecutorSupported;
438438

439-
// Temporarily disabling for Windows Threadpool, it fails but still unsure why
440-
[ConditionalFact(nameof(IsMetricsTestSupported), nameof(UsePortableThreadPool))]
439+
[ConditionalFact(nameof(IsMetricsTestSupported))]
441440
public void MetricsTest()
442441
{
443442
RemoteExecutor.Invoke(() =>
@@ -541,7 +540,8 @@ public void MetricsTest()
541540
Assert.True(totalWorkCountToQueue >= 1);
542541
waitForWorkStart = true;
543542
scheduleWork();
544-
Assert.True(ThreadPool.ThreadCount >= totalWorkCountToQueue);
543+
int threadCountLowerBound = UsePortableThreadPool ? totalWorkCountToQueue : 0;
544+
Assert.True(ThreadPool.ThreadCount >= threadCountLowerBound);
545545

546546
int runningWorkItemCount = queuedWorkCount;
547547

0 commit comments

Comments
 (0)