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

Broken build in version 7.0.200 #30623

Closed
rholek opened this issue Feb 15, 2023 · 4 comments
Closed

Broken build in version 7.0.200 #30623

rholek opened this issue Feb 15, 2023 · 4 comments
Labels
Area-NetSDK untriaged Request triage from a team member

Comments

@rholek
Copy link

rholek commented Feb 15, 2023

This code doesn't build with SDK 7.0.200

public class C
{
    public async Task M()
    {

        bool shoudRunAgain;

        async Task DoSomething()
        {
            Console.WriteLine("Test");
            shoudRunAgain = false;
        }

        await DoSomething();
        if (shoudRunAgain)
            await DoSomething();
    }
}

It fails with error
error CS0165: Use of unassigned local variable 'shoudRunAgain'

However with version 7.0.102 it builds without error

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Feb 15, 2023
@baronfel
Copy link
Member

This looks like new/fixed analyzers were included in 7.0.200, which is not a breaking change per se.

@baronfel
Copy link
Member

@jaredpar should this go to Roslyn?

@jaredpar
Copy link
Member

Correct. This is a duplicate of dotnet/roslyn#43697. This was a bug we decided to fix in 7.0 SDK.

@rholek
Copy link
Author

rholek commented Feb 16, 2023

I must say that I don't see a way this could run without shoudRunAgain being assigned since DoSomething is awaited. But I guess the analysis would be too complicated with that, so I understand.

However, this should be listed as a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

3 participants