Skip to content

1 == 1 produces no warning while 1 is 1 produces CS8520 #82869

@rampaa

Description

@rampaa

Version Used:
Visual Studio 2026 v18.4.1
.NET 9

Steps to Reproduce:

  1. See the following minimal code sample:
    public static void Test()
    {
        if (1 == 1) // Does not produce a warning like CS8520
        {
            Console.WriteLine("Test 1");
        }

        if (1 is 1) // CS8520
        {
            Console.WriteLine("Test 1");
        }
    }

Expected Behavior:
1 == 1 should raise a warning like how 1 is 1 raises CS8520

Actual Behavior:
No warning is raised for 1 == 1

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