Skip to content

SA1121: Inconsistent behaviour with respect to global using aliases #3594

Open
@BBreiden

Description

@BBreiden

If a global using alias is defined in another file, SA1121 does not produce a warning.
For example, the analyzer will not produce a warning in NoWarning.cs, but in AWarning.cs it does:

GlobalUsings.cs:

global using fp64 = System.Double;

NoWarning.cs:

public class TestWarning
{
    private double Method()
    {
        fp64 x = System.Math.PI;
        return x;
    }
}

AWarning.cs:

using MyMath = System.Math;

public class TestWarning2
{
    private double Method()
    {
        fp64 x = MyMath.PI;
        return x;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions