Handle telemetry MAC lookup failures when network interfaces are unavailable#54334
Open
Copilot wants to merge 3 commits into
Open
Handle telemetry MAC lookup failures when network interfaces are unavailable#54334Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
Agent-Logs-Url: https://github.com/dotnet/sdk/sessions/a339264f-6100-49f9-ab2d-c8a18347e069 Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/sdk/sessions/a339264f-6100-49f9-ab2d-c8a18347e069 Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix cli telemetry results in NetworkInformationException
Handle telemetry MAC lookup failures when network interfaces are unavailable
May 15, 2026
Contributor
|
This PR has been labeled with
|
Member
|
Fix looks reasonable to me. We already have fallback logic. This just explicitly catches the network exception and uses the same fallback logic to produce an ID. |
marcpopMSFT
approved these changes
May 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens CLI telemetry initialization so MAC address lookup failures from unavailable network interfaces do not crash CLI startup. It keeps machine ID telemetry best-effort by falling back to generated GUIDs.
Changes:
- Catches
NetworkInformationExceptionduring telemetry machine ID generation. - Adds regression coverage for MAC lookup throwing
NetworkInformationException.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Cli/dotnet/Telemetry/TelemetryCommonProperties.cs |
Adds fallback handling for network information failures during machine ID generation. |
test/dotnet.Tests/TelemetryTests/TelemetryCommonPropertiesTests.cs |
Adds a targeted test validating GUID fallback behavior when MAC lookup throws. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CLI startup could fail in telemetry initialization when MAC address retrieval falls back to
NetworkInterface.GetAllNetworkInterfaces()on systems where netlink sockets are unavailable. In that environment,NetworkInformationExceptionescaped and crashed commands likedotnet --version.Telemetry machine ID fallback hardening
TelemetryCommonProperties.GetMachineId()to catchNetworkInformationExceptionfrom MAC lookup and fall back to a generated GUID instead of allowing process-terminating initialization failure.Targeted regression coverage
NetworkInformationExceptionfromgetMACAddressand verifies both machine ID fields continue to be produced as GUIDs via fallback behavior.