Skip to content

Conversation

@AlekseyTs
Copy link
Contributor

Fixes #81576.

A binder with the flag was injected manually as the current binder while binding attributes. Because of that BinderFlags.AttributeArgument was not preserved by GetBinder API. For example the API is used during binding of nameof. Various checks responsible for breaking infinite binding cycles are relying on presence of the flag.

Since after the change the flag is preserved when we are binding nameof, I had to add a fixup in several places to properly support IDS_FeatureInstanceMemberInNameof feature in context of an attribute. See #67461 that initially added support for the feature.

…er chain

The binder with the flag was injected manually as the current binder while binding attributes. Because of that BinderFlags.AttributeArgument was not preserved by `GetBinder` APIs. For example the API is used during binding of `nameof`. Various checks responsible for breaking infinite binding cycles were relying on the presence of the flag.

Since after the change the flag is preserved when we are binding `nameof`, I had to add a fixup in several places to properly support IDS_FeatureInstanceMemberInNameof in context of an attribute. See dotnet#67461 that initially added support for the feature.
@AlekseyTs AlekseyTs requested a review from jjonescz December 10, 2025 02:58
@AlekseyTs AlekseyTs requested a review from a team as a code owner December 10, 2025 02:58
@AlekseyTs AlekseyTs requested a review from jcouv December 10, 2025 02:59
/// <returns>True if a reference to "this" is available.</returns>
internal bool HasThis(bool isExplicit, out bool inStaticContext)
{
if (!isExplicit && IsInsideNameof && Compilation.IsFeatureEnabled(MessageID.IDS_FeatureInstanceMemberInNameof))
Copy link
Member

Choose a reason for hiding this comment

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

I didn't follow why !isExplicit is needed in this check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't follow why !isExplicit is needed in this check.

There are no tests indicating that it must not be present. If you have a scenario in mind, please suggest an example.

Copy link
Contributor Author

@AlekseyTs AlekseyTs Dec 10, 2025

Choose a reason for hiding this comment

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

My goal was to use most conservative conditions to fix failing tests.

@AlekseyTs AlekseyTs requested a review from a team December 10, 2025 16:59
@AlekseyTs
Copy link
Contributor Author

@jcouv, @dotnet/roslyn-compiler For a second review.

@AlekseyTs AlekseyTs merged commit d768799 into dotnet:main Dec 11, 2025
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Dec 11, 2025
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.

Fatal VS crash when invoking completion session

3 participants