question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SA1118 still issues warning eventhough disabled in *.ruleset

See original GitHub issue

Environment: VS2017, StyleCop.Analyzers 1.0.2.

I disabled SA1118 (None or Hidden), the editor doesn’t show warning but running build still issues warning in this case:

        public static readonly EmailTemplateDefinition TestEmail = new EmailTemplateDefinition(
            name: "app.email-templates.test-email",
            subject: "Test email ignore please",
            body: @"<p>This is test email, please ignore.</p>
<p></p>
<p>---</p>
<p>FxCompanyName</p>",
            editable: false);

Calling inside another method doesn’t produce any warning.

Disable by pragma doesn’t work too. Workaround using SuppressMessage ok.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ltvancommented, Mar 22, 2018

Sorry, I think I found the problem. I migrated my project from Stylecop.MSBuild.Targets but forgot to remove the link to the target file. So that warning is from the old one. When I tried in other situations, I placed the long params at the first parameter so it passed the rule.

PS: the old Stylecop rule statement is missing this part other than the first parameter so I didn’t recognize that:

warning : SA1118 : CSharp.Readability : The parameter spans multiple lines. If the parameter is short, place the entire parameter on a single line. Otherwise, save the contents of the parameter in a temporary variable and pass the temporary variable as a parameter. 
0reactions
sharwellcommented, Mar 22, 2018

👍 glad to hear it’s worked out!

Read more comments on GitHub >

github_iconTop Results From Across the Web

StyleCopAnalyzers/documentation/SA1118.md at master
An implementation of StyleCop rules using the .NET Compiler Platform - StyleCopAnalyzers/documentation/SA1118.md at master ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found