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

Add analyzer "Invalid argument null check" (RCS1256) #888

Merged
merged 33 commits into from Nov 19, 2022

Conversation

josefpihrt
Copy link
Collaborator

No description provided.

# Conflicts:
#	src/Analyzers/CSharp/Analysis/ValidateArgumentsCorrectlyAnalyzer.cs
# Conflicts:
#	src/Analyzers.CodeFixes/CSharp/CodeFixes/IfStatementCodeFixProvider.cs
#	src/Analyzers.CodeFixes/CSharp/CodeFixes/ValidateArgumentsCorrectlyCodeFixProvider.cs
#	src/Analyzers/CSharp/Analysis/ValidateArgumentsCorrectlyAnalyzer.cs
#	src/Analyzers/CSharp/DiagnosticIdentifiers.Generated.cs
#	src/Analyzers/CSharp/DiagnosticRules.Generated.cs
#	src/Common/ArgumentNullCheckAnalysis.cs
This reverts commit 9139d7d.

# Conflicts:
#	src/Analyzers/Analyzers.xml
@josefpihrt josefpihrt changed the title Add analyzer "Unnecessary null check" Add analyzer "Invalid argument null check" Nov 19, 2022
@josefpihrt josefpihrt changed the title Add analyzer "Invalid argument null check" Add analyzer "Invalid argument null check" (RCS1256) Nov 19, 2022
@josefpihrt josefpihrt merged commit abe91e6 into main Nov 19, 2022
@josefpihrt josefpihrt deleted the feature/unnecessary-null-check branch November 19, 2022 18:16
@BenjaminBrienen
Copy link

I wish you provided a description so that I could understand the reasoning for this lint, and how to fix the issue.

@josefpihrt
Copy link
Collaborator Author

@BenjaminBrienen Description can be found here: https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1256.md.

I can provide more detailed info if necessary.

@BenjaminBrienen
Copy link

BenjaminBrienen commented Feb 2, 2023

Yes, please. I had a parameter that was a nullable interface type (IMyInterface<Generic>?), and when I did a null check on it, I got this lint. When I removed the null check, I got a different lint warning me that the value of the parameter may be null (when I try to use it as an argument).

@josefpihrt
Copy link
Collaborator Author

Could you please create new issue and provide a code sample there? Thanks.

Haarmees pushed a commit to Haarmees/Roslynator that referenced this pull request Oct 30, 2023
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.

None yet

2 participants