Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jcouv
Copy link
Member

@jcouv jcouv commented Dec 13, 2025

DataFlowAnalyzer.SetAnalysisDataOnMethodExit has logic to recognize assignments to ref/out parameters as reachable and used, The fix is to perform the analysis considering the full set of parameters, including the extension parameter.

Fixes #81554

@jcouv jcouv self-assigned this Dec 13, 2025
@jcouv jcouv added the Feature - Extension Everything The extension everything feature label Dec 13, 2025
@jcouv jcouv marked this pull request as ready for review December 15, 2025 21:11
@jcouv jcouv requested a review from a team as a code owner December 15, 2025 21:11
@jcouv
Copy link
Member Author

jcouv commented Dec 16, 2025

@CyrusNajmabadi @dotnet/roslyn-ide for review. Thanks

#else
if (owningSymbol.ContainingSymbol is INamedTypeSymbol { IsExtension: true, ExtensionParameter: { } extensionParameter })
{
return parameters.Insert(0, extensionParameter);
Copy link
Contributor

Choose a reason for hiding this comment

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

this is fine with me. but i'm curious why this was placed in position 0. it's not obvious as to why. consider doc'ing.

Comment on lines 141 to 151
var parameters = owningSymbol.GetParameters();
#if ROSLYN_4_12_OR_LOWER
return parameters;
#else
if (owningSymbol.ContainingSymbol is INamedTypeSymbol { IsExtension: true, ExtensionParameter: { } extensionParameter })
{
return parameters.Insert(0, extensionParameter);
}

return parameters;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
var parameters = owningSymbol.GetParameters();
#if ROSLYN_4_12_OR_LOWER
return parameters;
#else
if (owningSymbol.ContainingSymbol is INamedTypeSymbol { IsExtension: true, ExtensionParameter: { } extensionParameter })
{
return parameters.Insert(0, extensionParameter);
}
return parameters;
#endif
var parameters = owningSymbol.GetParameters();
#if !ROSLYN_4_12_OR_LOWER
if (owningSymbol.ContainingSymbol is INamedTypeSymbol { IsExtension: true, ExtensionParameter: { } extensionParameter })
{
return parameters.Insert(0, extensionParameter);
}
#else
return parameters;
#endif

Copy link
Contributor

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

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

Signing off as none of the feedback is blocking.

@jcouv jcouv enabled auto-merge (squash) December 16, 2025 21:54
@jcouv jcouv disabled auto-merge December 16, 2025 21:54
@jcouv jcouv enabled auto-merge (squash) December 16, 2025 21:54
@jcouv jcouv merged commit a49b421 into dotnet:main Dec 16, 2025
25 of 26 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Dec 16, 2025
@davidwengier davidwengier modified the milestones: Next, 18.3 Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDE0059 message is not correct for C#14 extension method

3 participants