Skip to content

IDE0048 triggers for type conversion with as operator in null-coalescing expression #79286

@akoeplinger

Description

@akoeplinger

Version Used: .NET 10 SDK

Steps to Reproduce:

  1. IDirectory? relTo = relativeTo as IDirectory ?? relativeTo.Parent;
  2. It will trigger IDE0048

Noticed this in dotnet/dotnet#1370, all the code patterns that use as and ?? now trigger IDE0048, even though this is not ambiguous and shouldn't need a parenthesis.

Likely caused by #79159

/cc @CyrusNajmabadi

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions