Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'use conditional expression' where it was causing a null-ref warning. #76792

Merged
merged 7 commits into from
Jan 17, 2025

Conversation

CyrusNajmabadi
Copy link
Member

Fixes #75200
Fixes #63441

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner January 17, 2025 04:43
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 17, 2025
@CyrusNajmabadi
Copy link
Member Author

@JoeRobich ptal :)

}
}

yield break;
Copy link
Contributor

Choose a reason for hiding this comment

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

yield break;

Curious what the yield break provides here

Copy link
Member Author

Choose a reason for hiding this comment

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

nothing whatsoever :D i started with that tehre originally as i TDDed the impl of this. and i never removed. can do so in followup :)

{
public static void TestMethod(Test test)
{
if (test is not null && test.Field is null)
Copy link
Contributor

Choose a reason for hiding this comment

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

if (test is not null && test.Field is null)

Is something like the following handled?

if (test?.Field is not null)
{
test.Field = string.Empty;
}
else
{
throw new InvalidOperationException();
}

Copy link
Member Author

Choose a reason for hiding this comment

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

probably not. i can see about handling that in followup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
4 participants