Skip to content

[CodePlex] Error CS7023 'is' for static classes [breaking compiler change] #324

@gafter

Description

@gafter

Originally from http://roslyn.codeplex.com/workitem/315

@jankucera reported:
The ShellProperty<T> class from WindowsAPICodePackstopped compiling in Roslyn.

It uses the Nullable class in the way similar to this:

class MyClass<T>
{
    public bool IsNullable(T value)
    {
       return value is Nullable;
   }
}

which, since Nullable is a static class, likely does not do what intended.

Roslyn generates

error CS7023: The second operand of an 'is' or 'as' operator may not be static type 'System.Nullable'.

However, shouldn't this be treated more as "The result of the expression is always 'false'" warning?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions