Skip to content

Pattern matching silences VSTHRD010 #375

@kfertitta

Description

@kfertitta

Bug description

VSTHRD010 is not reported when pattern matching.

Repro steps

See code below.

Expected behavior

Rule violation should be reported.

Actual behavior

Rule violation is not reported when suggested code fix for pattern matching is applied.

Additional context

Violation is properly reported for the following:

var uiShell = GetService(typeof(SVsUIShell)) as IVsUIShell;

if (uiShell == null)

Applying the suggested code fix for pattern matching yields the following, which incorrectly silences the violation:

if (!(GetService(typeof(SVsUIShell)) is IVsUIShell uiShell))

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions