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

UpgradeMSBuildWorkspaceAnalyzer tests doesn't match real behavior #6323

Closed
Youssef1313 opened this issue Dec 10, 2022 · 2 comments · Fixed by #6324
Closed

UpgradeMSBuildWorkspaceAnalyzer tests doesn't match real behavior #6323

Youssef1313 opened this issue Dec 10, 2022 · 2 comments · Fixed by #6324

Comments

@Youssef1313
Copy link
Member

protected UpgradeMSBuildWorkspaceAnalyzer(bool performAssemblyChecks)
{
_performAssemblyChecks = performAssemblyChecks;
}

This is always true in production code:

public CSharpUpgradeMSBuildWorkspaceAnalyzer()
: this(performAssemblyChecks: true)
{
}

and always false in unit tests:

internal class TestCSharpUpgradeMSBuildWorkspaceAnalyzer : CSharpUpgradeMSBuildWorkspaceAnalyzer
{
public TestCSharpUpgradeMSBuildWorkspaceAnalyzer()
: base(performAssemblyChecks: false)
{
}
}

Something is wrong here. @mavasani I'd like to clean this up, but want to understand more the expected behavior from this analyzer and some history and what problem it is trying to solve.

@Youssef1313
Copy link
Member Author

I attempted to fix this in #6324. But none of the tests produce a diagnostic when executed against the "real" analyzer used in production.

@Youssef1313
Copy link
Member Author

I think I was able to correct the tests per https://gist.github.com/jmarolf/49173eb81f7bd26a2709087c5769c727 (thanks @jmarolf for this gist).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant