Skip to content

Enable SendTo/Multicast AccessDenied tests on Apple platforms#131207

Draft
kotlarmilos with Copilot wants to merge 2 commits into
mainfrom
copilot/enable-test-sendto-datagram-udp-accessdenied
Draft

Enable SendTo/Multicast AccessDenied tests on Apple platforms#131207
kotlarmilos with Copilot wants to merge 2 commits into
mainfrom
copilot/enable-test-sendto-datagram-udp-accessdenied

Conversation

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

SendTo<T>.Datagram_UDP_AccessDenied_Throws_DoesNotBind and SocketOptionNameTest.MulticastInterface_Set_AnyInterface_Succeeds were neutered by a runtime SkipTestException workaround: on Apple platforms they skipped instead of asserting whenever a UDP send to the broadcast address returned HostUnreachable (the macOS 15+ "Local Network" privacy permission surfaces EHOSTUNREACH rather than EACCES). A skip is not a pass, so the coverage was effectively disabled.

Changes

  • SendTo.cs — Removed the HostUnreachable/SkipTestException branch so the test asserts AccessDenied again; reverted [ConditionalFact] back to [Fact] (the conditional existed only to honor the skip).
  • SocketOptionNameTest.cs — Removed the equivalent try/catch skip from MulticastInterface_Set_AnyInterface_Succeeds, restoring the plain await MulticastInterface_Set_Helper(0); body.
[Fact]
[SkipOnPlatform(TestPlatforms.FreeBSD, "FreeBSD allows sendto() to broadcast")]
public async Task Datagram_UDP_AccessDenied_Throws_DoesNotBind()
{
    IPEndPoint invalidEndpoint = new IPEndPoint(IPAddress.Broadcast, 1234);
    using var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
    byte[] buffer = new byte[32];

    SocketException e = await Assert.ThrowsAnyAsync<SocketException>(() => SendToAsync(socket, new ArraySegment<byte>(buffer), invalidEndpoint));
    Assert.Equal(SocketError.AccessDenied, e.SocketErrorCode);
    Assert.Null(socket.LocalEndPoint);
}

Notes for reviewers

  • These are test-only changes. The purpose is to let CI report the actual Apple-leg outcome on the new macOS queues.
  • The correct long-term fix is infrastructure: granting the Helix macOS runners the "Local Network" permission. If the Apple legs still surface HostUnreachable, that permission is not yet in place and enablement should wait on it.
  • Verified locally on Linux: SendTo_SyncSpan.Datagram_UDP_AccessDenied_Throws_DoesNotBind passes. MulticastInterface_Set_AnyInterface_Succeeds could not be exercised in the sandbox (container blocks broadcast/multicast sends, failing in CreateBoundUdpSocket before the edited code) — an environment limitation, not a regression.

Copilot AI review requested due to automatic review settings July 22, 2026 12:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
16 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

…nreachable skip

Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 22, 2026 13:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI changed the title [WIP] Enable SendTo Datagram UDP AccessDenied test for macOS Enable SendTo/Multicast AccessDenied tests on Apple platforms Jul 22, 2026
Copilot AI requested a review from kotlarmilos July 22, 2026 13:30
@kotlarmilos

Copy link
Copy Markdown
Member

/azp run runtime-ioslike

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[macOS] SendTo_.*.Datagram_UDP_AccessDenied_Throws_DoesNotBind cannot reach host

3 participants