Skip to content

Use OverloadResolutionPriority with Debug/Trace.Assert(string)#104942

Merged
stephentoub merged 2 commits intodotnet:mainfrom
stephentoub:debugassertpriority
Jul 17, 2024
Merged

Use OverloadResolutionPriority with Debug/Trace.Assert(string)#104942
stephentoub merged 2 commits intodotnet:mainfrom
stephentoub:debugassertpriority

Conversation

@stephentoub
Copy link
Copy Markdown
Member

using System.Diagnostics;

SomeMethod(6, 10);

static void SomeMethod(int a, int b)
{
    Debug.Assert(a > 0);
    Debug.Assert(b > 0);
    Debug.Assert((a - 3) > (b / 2));
}

Before:

Process terminated. Assertion failed.
   at Program.<<Main>$>g__SomeMethod|0_0(Int32 a, Int32 b)

After:

Process terminated. Assertion failed.
(a - 3) > (b / 2)
   at Program.<<Main>$>g__SomeMethod|0_0(Int32 a, Int32 b)

@ghost
Copy link
Copy Markdown

ghost commented Jul 16, 2024

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

1 similar comment
@ghost
Copy link
Copy Markdown

ghost commented Jul 16, 2024

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

@KennethHoff
Copy link
Copy Markdown

inb4 this is also unexpectedly breaking akin to ICollection : IReadOnlyCollection 😅

@stephentoub
Copy link
Copy Markdown
Member Author

inb4 this is also unexpectedly breaking akin to ICollection : IReadOnlyCollection 😅

How is this breaking?

@KennethHoff
Copy link
Copy Markdown

KennethHoff commented Jul 17, 2024

No idea. It was a bad joke. It's similar-ish DX improvements to old APIs so it would be (not..) funny if they both had similar reasons to not be improved; back compatibility breaks.

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants