A compile error that isn't detected

I had a stupid line of code:

Guid guid = value as Guid;

Resharper was fine with this, but the compiler complains with:

ERROR #: CS0077
The as operator must be used with a reference type ('System.Guid' is a value
type)

The "as Guid" was redundant in this case (it was a property set method and
the property was a Guid type), but still, Resharper should have caught this.
Just FYI.




1 comment
Comment actions Permalink

Thank you for your feedback.
Highlighting this error is not implemented.

--
Andrey Simanovsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"



"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:cistef$ind$1@is.intellij.net...

I had a stupid line of code:

>

Guid guid = value as Guid;

>

Resharper was fine with this, but the compiler complains with:

>

ERROR #: CS0077
The as operator must be used with a reference type ('System.Guid' is a

value

type)

>

The "as Guid" was redundant in this case (it was a property set method and
the property was a Guid type), but still, Resharper should have caught

this.

Just FYI.

>
>
>
>


0

Please sign in to leave a comment.