No built-in types vs. built-in types

Answered

I've the following code:

var a = string.Empty;

ReSharper suggests me to change this to CLR type name - what is ok.

I change it to "String.Empty"

Then I apply a Silent Cleanup Code (Resharper->Edit->Silent Cleanup Code) and ReSharper changed all "String.empty" back to "string.empty" ... complaining afterwards, I should use CLR - what I really want :-)

 

Where is the option to change this behavior of ReSharper?

 

Thanks

Konrad

7 comments
Comment actions Permalink
Official comment

Hello Konrad,

Thanks for the settings file and the info.

Seems like StyleCop plugin is a root of the problem. If you disable "For Stylecop violation | Fix Stylecop violation" on "ReSharper | Opitons | Code Editing | Code Cleanup" page for a profile - the issue will stop happening. 

It looks as if it is still apply SA1121 rule despite the fact it is disabled in "Inspection Severity" section. 

So, please consider opening a new issue on https://github.com/StyleCop/StyleCop/issues page. 

Thanks! 

Comment actions Permalink

Please select ReSharper | Options | Code Editing | C# | Code Style | Built-in type naming | When referencing built-in type, prefer using | CLR type name.

Thanks! 

0
Comment actions Permalink

Thanks for your answer.

But this option was and is set.

ReSharper still converts:

private string _paramFile = String.Empty;

to

private String _paramFile = string.Empty;
0
Comment actions Permalink

Hello Konrad,

Please:

  • specify R# version installed on the machine;
  • specify if there are any R# plugins installed (ReSharper | Extension Manager); 
  • export all R# settings (ReSharper | Manage Options | "Export to file" for each layer) and submit a new request with such files attached (Submit a request link above).

Thanks! 

0
Comment actions Permalink

1. C# Version: 6.0 - Visual Studio 2015 Enterprise

2. There is only one plugin installed: StyleCop by JetBrains 2016.1.0

3. Here are the ReSharper-Settings: https://www.dropbox.com/s/crgg671e4erqjd5/reSharperSettings.DotSettings?dl=0

0
Comment actions Permalink

Hi Alexander,

this worked perfectly!

Thank you for your fast and capable help :-)

 

Konrad

0

Please sign in to leave a comment.