Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6c7dccf
Initial plan
Copilot Mar 12, 2026
f9012f7
De-duplicate PreAllocatedOverlapped.Browser.cs and PreAllocatedOverla…
Copilot Mar 12, 2026
2ef8f8f
Merge remote-tracking branch 'origin/main' into copilot/remove-duplic…
Copilot Mar 18, 2026
c4043c1
Include PreAllocatedOverlapped.Portable.cs unconditionally in Feature…
Copilot Mar 18, 2026
2fd9e73
Simplify .Unix.cs conditions in FeaturePortableThreadPool block to Ta…
Copilot Mar 18, 2026
044c13b
Add PreAllocatedOverlapped.Unix.cs into FeaturePortableThreadPool blo…
Copilot Mar 18, 2026
029f2d4
Sort PreAllocatedOverlapped entries alphabetically (Portable → Unix →…
Copilot Mar 19, 2026
bf29572
Merge remote-tracking branch 'origin/main' into copilot/remove-duplic…
Copilot Mar 19, 2026
8ddec44
Sort ThreadPoolBoundHandleOverlapped.cs before ThreadPoolCallbackWrap…
Copilot Mar 19, 2026
2671b4d
Add PreAllocatedOverlapped.NotSupported.cs; simplify FeatureMultithre…
Copilot Mar 19, 2026
42003c9
Merge remote-tracking branch 'origin/main' into copilot/remove-duplic…
Copilot Mar 19, 2026
6dfaec0
Rename Browser.cs → NotSupported.cs; use NotSupported.cs for all non-…
Copilot Mar 19, 2026
ba38481
UnsafeCreate throws directly; consolidate NotSupported.cs into single…
Copilot Mar 19, 2026
2ca86d5
Apply suggestion from @jkotas
jkotas Mar 19, 2026
3054412
Move ThreadPoolBoundHandleOverlapped.cs to the platform-neutral Windo…
Copilot Mar 19, 2026
a09ca2a
Rename NotSupported.cs → PlatformNotSupported.cs for PreAllocatedOver…
Copilot Mar 19, 2026
5abba67
Merge remote-tracking branch 'origin/main' into copilot/remove-duplic…
Copilot Mar 19, 2026
7655550
Move PreAllocatedOverlapped.WindowsThreadPool.cs to alphabetical posi…
Copilot Mar 19, 2026
4047563
Move Win32ThreadPoolNativeOverlapped*.cs to Windows-only ItemGroup
Copilot Mar 19, 2026
f971e07
Merge remote-tracking branch 'origin/main' into copilot/remove-duplic…
Copilot Mar 19, 2026
e571b21
Add Debug.Fail to ThreadPoolBoundHandle private constructor in Platfo…
Copilot Mar 19, 2026
f77e3c4
Restore working PreAllocatedOverlapped constructor/UnsafeCreate on no…
Copilot Mar 19, 2026
2c54043
Move DeferredDisposableLifetime.cs to Windows section; sort Threading…
Copilot Mar 19, 2026
aea91f8
Merge remote-tracking branch 'origin/main' into copilot/remove-duplic…
Copilot Mar 19, 2026
ffce285
Simplify PreAllocatedOverlapped.PlatformNotSupported.cs; mark tests W…
Copilot Mar 19, 2026
457f05c
Merge remote-tracking branch 'origin/main' into copilot/remove-duplic…
Copilot Mar 19, 2026
978de78
Add argument validation to PreAllocatedOverlapped.PlatformNotSupporte…
Copilot Mar 19, 2026
c9fc2bb
Merge remote-tracking branch 'origin/main' into copilot/remove-duplic…
Copilot Mar 19, 2026
8b9f2b2
Remove incorrectly applied [RequiresUnsafe] from AllocateNativeOverla…
Copilot Mar 19, 2026
6d73dd9
Remove [RequiresUnsafe] annotations from Overlapped.Pack and UnsafePack
Copilot Mar 19, 2026
2f32d9b
Merge branch 'main' into copilot/remove-duplicate-overlapped-implemen…
jkotas Mar 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<linker>
<assembly fullname="System.Private.CoreLib">
<type fullname="System.Threading.ThreadPoolBoundHandle">
<!-- Workaround to keep .interfaceimpl even though this type
is not instantiated on unix:
https://github.com/mono/linker/pull/649 -->
<method name=".ctor" />
</type>
</assembly>

<assembly fullname="System.Private.CoreLib" feature="System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting" featurevalue="true">
<!-- Native hosting accesses managed methods from
https://github.com/dotnet/runtime/blob/bbc898f3e5678135b242faeb6eefd8b24bf04f3c/src/native/corehost/hostpolicy/hostpolicy.cpp#L527-L538
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,6 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\CompressedStack.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Condition.cs" Condition="'$(FeatureMono)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\StackCrawlMark.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\DeferredDisposableLifetime.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\EventResetMode.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\EventWaitHandle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ExecutionContext.cs" />
Expand Down Expand Up @@ -1344,9 +1343,6 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\WaitHandle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\WaitHandleCannotBeOpenedException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\WaitHandleExtensions.cs" />
Comment thread
jkotas marked this conversation as resolved.
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Win32ThreadPoolNativeOverlapped.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Win32ThreadPoolNativeOverlapped.ExecutionContextCallbackArgs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Win32ThreadPoolNativeOverlapped.OverlappedData.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\ThreadStaticAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\ThrowHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\TimeOnly.cs" />
Expand Down Expand Up @@ -2350,18 +2346,23 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\RuntimeInformation.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\StandardOleMarshalObject.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Security\SecureString.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\DeferredDisposableLifetime.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\EventWaitHandle.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\LowLevelMonitor.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Mutex.Windows.cs" />
Comment thread
jkotas marked this conversation as resolved.
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.WindowsThreadPool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\RegisteredWaitHandle.WindowsThreadPool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Thread.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Semaphore.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\TimerQueue.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\TimerQueue.WindowsThreadPool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Thread.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.WindowsThreadPool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.WindowsThreadPool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandleOverlapped.cs" />
Comment thread
jkotas marked this conversation as resolved.
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\TimerQueue.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\TimerQueue.WindowsThreadPool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\WaitHandle.Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Win32ThreadPoolNativeOverlapped.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Win32ThreadPoolNativeOverlapped.ExecutionContextCallbackArgs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Win32ThreadPoolNativeOverlapped.OverlappedData.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\WindowsThreadPool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\TimeZoneInfo.Win32.cs" />
</ItemGroup>
Expand Down Expand Up @@ -2855,7 +2856,7 @@
<ItemGroup Condition="'$(FeaturePortableThreadPool)' == 'true'">
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\CompleteWaitThreadPoolWorkItem.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Portable.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Unix.cs" Condition="'$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Unix.cs" Condition="'$(TargetsWindows)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.Blocking.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.GateThread.cs" />
Expand All @@ -2866,27 +2867,24 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.WaitThread.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.WorkerThread.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.WorkerTracking.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.Unix.cs" Condition="'$(TargetsUnix)' == 'true' or ('$(TargetsBrowser)' == 'true' and '$(FeatureMultithreading)' != 'true') or '$(TargetsWasi)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.Unix.cs" Condition="'$(TargetsWindows)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PortableThreadPool.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\LowLevelLifoSemaphore.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\LowLevelLifoSemaphore.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\LowLevelLifoSemaphore.Unix.cs" Condition="'$(TargetsUnix)' == 'true' or '$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\LowLevelLifoSemaphore.Unix.cs" Condition="'$(TargetsWindows)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.Portable.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.Unix.cs" Condition="'$(TargetsUnix)' == 'true' or ('$(TargetsBrowser)' == 'true' and '$(FeatureMultithreading)' == 'true')" />
Comment thread
jkotas marked this conversation as resolved.
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.Portable.cs" Condition="'$(FeatureMultithreading)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\RegisteredWaitHandle.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\RegisteredWaitHandle.Unix.cs" Condition="'$(TargetsWindows)' != 'true'" />
Comment thread
jkotas marked this conversation as resolved.
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\RegisteredWaitHandle.Portable.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.Portable.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.Unix.cs" Condition="'$(TargetsWindows)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.Portable.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.Windows.cs" Condition="'$(TargetsWindows)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandleOverlapped.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolCallbackWrapper.cs" Condition="'$(FeatureNativeAot)' != 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Backoff.cs" />
</ItemGroup>
<ItemGroup Condition="'$(FeatureMultithreading)' != 'true'">
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.Browser.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.Browser.cs" />
<ItemGroup Condition="'$(TargetsWindows)' != 'true'">
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\PreAllocatedOverlapped.PlatformNotSupported.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPoolBoundHandle.PlatformNotSupported.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsBrowser)' == 'true' and '$(FeatureMultithreading)' != 'true'">
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPool.Browser.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ public IntPtr EventHandleIntPtr

[Obsolete("This overload is not safe and has been deprecated. Use Pack(IOCompletionCallback?, object?) instead.")]
[CLSCompliant(false)]
[RequiresUnsafe]
public NativeOverlapped* Pack(IOCompletionCallback? iocb)
=> Pack(iocb, null);

[CLSCompliant(false)]
[RequiresUnsafe]
public NativeOverlapped* Pack(IOCompletionCallback? iocb, object? userData)
{
if (_pNativeOverlapped != null)
Expand All @@ -95,12 +93,10 @@ public IntPtr EventHandleIntPtr

[Obsolete("This overload is not safe and has been deprecated. Use UnsafePack(IOCompletionCallback?, object?) instead.")]
[CLSCompliant(false)]
[RequiresUnsafe]
public NativeOverlapped* UnsafePack(IOCompletionCallback? iocb)
=> UnsafePack(iocb, null);

[CLSCompliant(false)]
[RequiresUnsafe]
public NativeOverlapped* UnsafePack(IOCompletionCallback? iocb, object? userData)
{
if (_pNativeOverlapped != null)
Expand Down Expand Up @@ -134,7 +130,6 @@ public static void Free(NativeOverlapped* nativeOverlappedPtr)
FreeNativeOverlapped(nativeOverlappedPtr);
}

[RequiresUnsafe]
private NativeOverlapped* AllocateNativeOverlapped(object? userData)
{
NativeOverlapped* pNativeOverlapped = null;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace System.Threading
{
public sealed class PreAllocatedOverlapped : IDisposable
{
[CLSCompliant(false)]
public PreAllocatedOverlapped(IOCompletionCallback callback, object? state, object? pinData)
{
ArgumentNullException.ThrowIfNull(callback);
throw new PlatformNotSupportedException(SR.PlatformNotSupported_OverlappedIO);
}
Comment thread
jkotas marked this conversation as resolved.

[CLSCompliant(false)]
public static PreAllocatedOverlapped UnsafeCreate(IOCompletionCallback callback, object? state, object? pinData)
{
ArgumentNullException.ThrowIfNull(callback);
throw new PlatformNotSupportedException(SR.PlatformNotSupported_OverlappedIO);
}

public void Dispose() { }
}
}

This file was deleted.

Loading
Loading