Skip to content

SA1135 throws exception for type keywords #3882

@rsking

Description

@rsking

When adding a type alias using a keyword, the analyzer throws AD0001, when inside a namespace

namespace ClassLibrary
{
    using Example = string;
}

and also when using value tuple values

namespace ClassLibrary
{
    using Example = (System.Collections.IList, int);
}

Activity

rsking

rsking commented on Aug 5, 2024

@rsking
Author

This does not occur when outside a namespace, but this violates SA1200

bjornhellander

bjornhellander commented on Aug 5, 2024

@bjornhellander
Contributor

What version are you using?

bjornhellander

bjornhellander commented on Aug 5, 2024

@bjornhellander
Contributor

Sorry! I asked because I couldn't reproduce it, but I see it now using the latest beta.

bjornhellander

bjornhellander commented on Aug 5, 2024

@bjornhellander
Contributor

I will have a look.

runehalfdan

runehalfdan commented on Aug 29, 2024

@runehalfdan

We've also encountered this bug, using StyleCop.Analyzers.Unstable 1.2.0.556 (can't use Beta for reasons)

namespace Library;
using Foo = (int A, string B);

Workaround (but names are lost):
using Foo = System.ValueTuple<int, string>;

YoshiRulz

YoshiRulz commented on May 16, 2025

@YoshiRulz

You can also

	<PropertyGroup>
		<NoWarn>$(NoWarn);SA1135</NoWarn>
	</PropertyGroup>

(#pragma around the line is not sufficient as the Analyzer still executes.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @rsking@bjornhellander@YoshiRulz@runehalfdan

      Issue actions

        SA1135 throws exception for type keywords · Issue #3882 · DotNetAnalyzers/StyleCopAnalyzers