Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 29, 2025

ErrorCodes in dotnet-trace and ReturnCode in Common are redundant. ReturnCode is the established standard across diagnostic tools (dotnet-trace, dotnet-counters) and provides better type safety as an enum. ErrorCodes existed only for legacy ConvertCommand usage.

Changes

  • ConvertCommand.cs: Migrated from ErrorCodes to ReturnCode

    • Added using Microsoft.Internal.Common.Utils
    • Replaced ErrorCodes.ArgumentError(int)ReturnCode.ArgumentError
    • Replaced ErrorCodes.UnknownError(int)ReturnCode.UnknownError
  • ErrorCode.cs: Removed completely

    • No longer needed as ConvertCommand now uses ReturnCode directly
- return ErrorCodes.ArgumentError;
+ return (int)ReturnCode.ArgumentError;

This standardizes error code handling across all diagnostic tools.

Testing

  • ✅ Build succeeded with 0 warnings, 0 errors
  • ✅ All 109 dotnet-trace unit tests passed
Original prompt

Can you assess the history of ErrorCode in src/Tools/dotnet-trace/CommandLine/Commands/ErrorCode.cs and ReturnCode in src/Tools/Common/Commands/Utils.cs. Can you assess whether they are overlapping in responsibility, and if so, can you deprecate ErrorCode in favor of ReturnCode?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 29, 2025 19:57
Co-authored-by: mdh1418 <16830051+mdh1418@users.noreply.github.com>
Co-authored-by: mdh1418 <16830051+mdh1418@users.noreply.github.com>
Copilot AI changed the title [WIP] Assess overlap between ErrorCode and ReturnCode Deprecate ErrorCodes in favor of ReturnCode Oct 29, 2025
Copilot AI requested a review from mdh1418 October 29, 2025 20:04
Copilot finished work on behalf of mdh1418 October 29, 2025 20:04
@mdh1418
Copy link
Member

mdh1418 commented Oct 29, 2025

@copilot Could we just remove ErrorCode.cs completely?

Co-authored-by: mdh1418 <16830051+mdh1418@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 29, 2025

@copilot Could we just remove ErrorCode.cs completely?

Done! ErrorCode.cs has been removed completely in commit 38a03e6. Also removed the accidentally added .nuget/nuget.exe file.

Copilot AI changed the title Deprecate ErrorCodes in favor of ReturnCode Replace ErrorCodes with ReturnCode Oct 29, 2025
Copilot finished work on behalf of mdh1418 October 29, 2025 20:22
@mdh1418 mdh1418 marked this pull request as ready for review October 29, 2025 20:23
@mdh1418 mdh1418 requested a review from a team as a code owner October 29, 2025 20:23
@hoyosjs
Copy link
Member

hoyosjs commented Oct 29, 2025

@microsoft-github-policy-service rerun

@hoyosjs hoyosjs enabled auto-merge (squash) October 29, 2025 23:36
@hoyosjs hoyosjs merged commit 929432b into main Oct 29, 2025
19 checks passed
@mdh1418 mdh1418 deleted the copilot/assess-errorcode-returncode branch October 30, 2025 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants