R# and Visual Studio 2019 "var" Usage Conflict

Completed

Hello,

I have set R# "var" usage set to "Use 'var' when evident" for all options (built-in types, simple types, and elsewhere). It is only configured to be a hint.

If I write a line of code like:

var profile = GetUsersProfile();

R# properly gives me a hint to change var to Profile.

As soon as I do this Visual Studio 2019 gives me an IDE0007 error stating "use 'var' instead of explicit type". 

How do I get R# and visual studio on the same page with the use of "var"? I assumed that whatever I set in R# that it would make whatever changes it needed in visual studio to avoid this type of conflict. Is this not the case?

Any help you can provide would be appreciated!

Take care,

Ken

3 comments
Comment actions Permalink

Hello Ken,

 

Sorry for the delay in responding.

If you don't mind I repost issue in YouTrack you've reported - https://youtrack.jetbrains.com/issue/RSRP-477025

Thank you.

0
Comment actions Permalink

Thanks Angelina.

0
Comment actions Permalink

 In case anyone comes across the same problem please note that since ReSharper 2019.3 new option ReSharper | Options | Code Editing | C# | Code Style > Prefer Roslyn (Visual Studio) logic for type evidence has appeared.

For detailed information please refer to the following help article  - https://www.jetbrains.com/help/resharper/Using_var_Keyword_in_Declarations.html#use-var-when-evident-details

0

Please sign in to leave a comment.