-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Enabling CA1416: Validate platform compatibility #41760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
3bd3361
3c0cbc5
91777a4
55d3daf
86d1c74
5760c43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,7 @@ private void InitializeInternals() | |
| bool suppressFlow = !ExecutionContext.IsFlowSuppressed(); | ||
| try | ||
| { | ||
| Debug.Assert(OperatingSystem.IsWindows()); | ||
| if (suppressFlow) ExecutionContext.SuppressFlow(); | ||
| _preAllocatedOverlapped = new PreAllocatedOverlapped(s_completionPortCallback, _strongThisRef, null); | ||
| } | ||
|
|
@@ -75,6 +76,7 @@ private void FreeInternals() | |
|
|
||
| private unsafe NativeOverlapped* AllocateNativeOverlapped() | ||
| { | ||
| Debug.Assert(OperatingSystem.IsWindows()); | ||
| Debug.Assert(_operating == InProgress, $"Expected {nameof(_operating)} == {nameof(InProgress)}, got {_operating}"); | ||
| Debug.Assert(_currentSocket != null, "_currentSocket is null"); | ||
| Debug.Assert(_currentSocket.SafeHandle != null, "_currentSocket.SafeHandle is null"); | ||
|
|
@@ -86,6 +88,7 @@ private void FreeInternals() | |
|
|
||
| private unsafe void FreeNativeOverlapped(NativeOverlapped* overlapped) | ||
| { | ||
| Debug.Assert(OperatingSystem.IsWindows()); | ||
| Debug.Assert(overlapped != null, "overlapped is null"); | ||
| Debug.Assert(_operating == InProgress, $"Expected _operating == InProgress, got {_operating}"); | ||
| Debug.Assert(_currentSocket != null, "_currentSocket is null"); | ||
|
|
@@ -904,6 +907,7 @@ private void FreeOverlapped() | |
| // any pinned buffers. | ||
| if (_preAllocatedOverlapped != null) | ||
| { | ||
| Debug.Assert(OperatingSystem.IsWindows()); | ||
| _preAllocatedOverlapped.Dispose(); | ||
| _preAllocatedOverlapped = null!; | ||
| } | ||
|
|
@@ -1219,7 +1223,11 @@ private void FinishOperationSendPackets() | |
|
|
||
| private static readonly unsafe IOCompletionCallback s_completionPortCallback = delegate (uint errorCode, uint numBytes, NativeOverlapped* nativeOverlapped) | ||
| { | ||
| var saeaBox = (StrongBox<SocketAsyncEventArgs>)ThreadPoolBoundHandle.GetNativeOverlappedState(nativeOverlapped)!; | ||
| #pragma warning disable CA1416 // https://github.com/dotnet/roslyn-analyzers/issues/4090 | ||
|
||
| Debug.Assert(OperatingSystem.IsWindows()); | ||
| var saeaBox = (StrongBox<SocketAsyncEventArgs>)(ThreadPoolBoundHandle.GetNativeOverlappedState(nativeOverlapped)!); | ||
| #pragma warning restore CA1416 // https://github.com/dotnet/roslyn-analyzers/issues/4090 | ||
|
|
||
| Debug.Assert(saeaBox.Value != null); | ||
| SocketAsyncEventArgs saea = saeaBox.Value; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.