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

SA1119 (Statements must not use unnecessary parenthesis) suggest wrong fix #2776

Closed
Nicte opened this issue Sep 7, 2018 · 1 comment
Closed

Comments

@Nicte
Copy link

Nicte commented Sep 7, 2018

Version: 1.0.2

I have the following line:

if (!(actionExecutedContext.Request.GetDependencyScope().GetService(typeof(FileDispatchContext)) is FileDispatchContext dbContext))

The parenthesis are necessary here because the proposed fix results in:

if (!actionExecutedContext.Request.GetDependencyScope().GetService(typeof(FileDispatchContext)) is FileDispatchContext dbContext)

Which fails because "Error: CS0023 Operator '!' cannot be applied to operand of type 'object'"

@sharwell
Copy link
Member

sharwell commented Sep 7, 2018

Duplicate of #2372

@sharwell sharwell marked this as a duplicate of #2372 Sep 7, 2018
@sharwell sharwell closed this as completed Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants