Incorrect refactoring

Resharper wants to refactor this code and remove the "new Guid?". When it does, the compiler complains. ("Guid1" is a plain System.Guid)
 
 
public Guid? NullableGuid
{
get { return Guid1 == Guid.Empty ? null : new Guid?(Guid1); }
set { Guid1 = value ?? Guid.Empty; }
}
 
Resharper converts this to:
get { return Guid1 == Guid.Empty ? null : Guid1; }
A valid refactoring seems to be:
get { return Guid1 == Guid.Empty ? null : (Guid?)Guid1; }
]]>

2 comments
Comment actions Permalink

This is in 781.
Resharper wants to refactor this code and remove the "new Guid?". When it does, the compiler complains. ("Guid1" is a plain System.Guid)
 
 
public Guid? NullableGuid
{
get { return Guid1 == Guid.Empty ? null : new Guid?(Guid1); }
set { Guid1 = value ?? Guid.Empty; }
}
 
Resharper converts this to:
get { return Guid1 == Guid.Empty ? null : Guid1; }
A valid refactoring seems to be:
get { return Guid1 == Guid.Empty ? null : (Guid?)Guid1; }
]]>

0
Comment actions Permalink

Hello,

We appreciate your feedback. The corresponding JIRA request has been created,
and you are welcome to monitor its status at http://www.jetbrains.net/jira/browse/RSRP-66171.

You may want to check our request tracking policy here: http://www.jetbrains.net/confluence/display/ReSharper/ReSharperIssueTracker

Best regards,
- Development Team.


0

Please sign in to leave a comment.