Skip to content

IDE0270 is firing in a case that can't be simplified #81987

@ViktorHofer

Description

@ViktorHofer

Version Used: 11.0.100-alpha.1.26060.102

Steps to Reproduce:

  1. Remove the pragma warning disable IDE0270 here: https://github.com/dotnet/dotnet/blob/a6194a79ac71f2d3b55ac81f292d8a2c49d41f91/src/winforms/src/System.Windows.Forms/System/Windows/Forms/WindowSubclassHandler.cs#L102
  2. Build the winforms repo or the VMR
  3. Observe that IDE0270 is firing even though the code can't be simplified

Diagnostic Id: IDE0270 - Null check can be simplified

When applying the code fixer, I get the following error:

D:\a_work\1\s\src\winforms\src\System.Windows.Forms\System\Windows\Forms\WindowSubclassHandler.cs(97,31): error CS0019: Operator '??' cannot be applied to operands of type 'void*' and '' [D:\a_work\1\s\src\winforms\src\System.Windows.Forms\System.Windows.Forms.csproj]

Expected Behavior:
IDE0270 shouldn't be raised in this case when void* is used.

Actual Behavior:
IDE0270 is raised but the code fixer produces non-compliable code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions