Skip to content

Missing "variable is assigned but its value is never used" warning for assignment utilizing UTF8 String Literal #60319

@AlekseyTs

Description

@AlekseyTs
class Program
{
    static void Main()
    {
        var x = "123"U8; // <- Missing a warning here?
        var y = "abc"; // warning CS0219: The variable 'y' is assigned but its value is never used

        byte[] z1 = "345"; // <- Missing a warning here?
        System.Span<byte> z2 = "678"; // warning CS0219: The variable 'z2' is assigned but its value is never used
        System.ReadOnlySpan<byte> z3 = "678"; // warning CS0219: The variable 'z3' is assigned but its value is never used
    }
}

Metadata

Metadata

Assignees

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