#pragmas

Is there a documented list of the #pragma statements supported by RS which we can use?

Are the #pragma types builtin to .Net or are they RS extensions. What I want to do is use a #pragma that will let me optionally remove a method from the analysis phase. I'm on a green square mission and I want to stop RS from analysing my windows form InitializeComponent method. RS is given me 100's of warnings and as the method is maintained by the IDE I'd like to remove it from the analysis.

Any ideas if I can do that?

4 comments
Comment actions Permalink

Hello Peter,

Surround InitializeComponent with the #region Windows Form Designer generated
code
ReSharper will suppress specific set of warnings for such code.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


IR> Is there a documented list of the #pragma statements supported by RS
IR> which we can use?
IR>
IR> Are the #pragma types builtin to .Net or are they RS extensions.
IR> What I want to do is use a #pragma that will let me optionally
IR> remove a method from the analysis phase. I'm on a green square
IR> mission and I want to stop RS from analysing my windows form
IR> InitializeComponent method. RS is given me 100's of warnings and as
IR> the method is maintained by the IDE I'd like to remove it from the
IR> analysis.
IR>
IR> Any ideas if I can do that?
IR>


0
Comment actions Permalink

Ilya,

I've now got the InitializeComponent code in it's own source file and it has the region statement around it. RS still shows a yellow box with 100's of warning. Another of your colleagues, Andrey, told me to use Ctrl-8 to suppress the source file from the analysis but the Ctrl-8 does is not remembered when you exit and reopen the project/solution.

Either way, the #region statement does not help in suppressing the warmings.

0
Comment actions Permalink

Make sure you have the text in the region set to exactly "Windows Form
Designer generated code" as below.

#region Windows Form Designer generated code

private void InitializeComponent()
{
...
}

#endregion


"Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
news:76a2bd0b14e55e8ca2a4dc35d75e8@news.intellij.net...

Hello Peter,

>

Surround InitializeComponent with the #region Windows Form Designer
generated code
ReSharper will suppress specific set of warnings for such code.

>

Sincerely,
Ilya Ryzhenkov

>

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>
>

IR> Is there a documented list of the #pragma statements supported by RS
IR> which we can use?
IR> IR> Are the #pragma types builtin to .Net or are they RS extensions.
IR> What I want to do is use a #pragma that will let me optionally
IR> remove a method from the analysis phase. I'm on a green square
IR> mission and I want to stop RS from analysing my windows form
IR> InitializeComponent method. RS is given me 100's of warnings and as
IR> the method is maintained by the IDE I'd like to remove it from the
IR> analysis.
IR> IR> Any ideas if I can do that?
IR>

0
Comment actions Permalink

Found it!

There is a very big difference between

#region Windows Form Designer generated code

#region Windows Form Designer generated code.

For some reason when I was moving code around the partial classes I deleted the original #region text and then added it back again, this time appending the full stop "." at the end of it. That's just me being a bit anal in my pursuit of trying to be grammatically correct. Once I remove the full stop at the end, then RS was able to reanalyse the code and this time I've now got a nice green square! :)

Thanks.

0

Please sign in to leave a comment.