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.

Build performance concerns.

See original GitHub issue

I’ve got a small project that takes 3 seconds to compile without stylecop analyzers, adding them to the project increases compilation time to 13 seconds. It’s not an issue for CI or manual(command line) build, but I definitely would not expect 400% percent longer builds in Visual Studio during development time especially taking into account that validation happens in background during file editing(incremental compilation) anyway. Is there any way to disable analyzers completely for VBCSCompiler when I build from Visual Studio? I tried the following hack, it disables analyzers for debug builds, but the build still takes 5-6 seconds instead of expected 3.

        public static void HandleCompilationStart(CompilationStartAnalysisContext context)
        {
            if (context.Options.GetType().FullName == "Microsoft.CodeAnalysis.Diagnostics.WorkspaceAnalyzerOptions" || context.Compilation.Options.OptimizationLevel == OptimizationLevel.Release)
            {
                // ...
            }
        }

Thoughts?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
sharwellcommented, Oct 26, 2015

@NikGovorov Just add the following at the end of your project file:

<Target Name="DisableAnalyzersForVisualStudioBuild"
        BeforeTargets="CoreCompile"
        Condition="'$(BuildingInsideVisualStudio)' == 'True' And '$(BuildingProject)' == 'True'">
  <!--
    Disable analyzers when building a project inside Visual Studio. Note that analyzer behavior for IntelliSense
    purposes is not altered by this.
  -->
  <ItemGroup>
    <Analyzer Remove="@(Analyzer)"/>
  </ItemGroup>
</Target>
1reaction
sharwellcommented, Oct 30, 2015

BTW. it should work this way right inside Visual Studio, maybe to be implemented on some VS update, but at least there is this workaround now.

For users who enable “warnings as errors” and users who use a rule set file to treat specific analyzer warnings as errors, which would cause building in Visual Studio to produce different results than building from the command line. This would dramatically increase the chances that developers commit code they believe works but in reality causes the automated build for their project to fail.

This issue is sufficiently important that I am quite comfortable advising people to avoid this build customization and instead focus on continually reducing the performance overhead of the StyleCop Analyzers.

That said, I’ll open a new issue to include this information somewhere in the documentation. (It’s #1711.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with Performance Problems
Quantity of work (untimely completion, limited production). Poor prioritizing, timing, scheduling; Lost time ; Quality of work (failure to meet quality standards).
Read more >
Troubleshoot build performance with Build Analyzer
Use the Build Analyzer to inspect the build performance of your project. For each build you perform, the Build Analyzer tries to present...
Read more >
5 Best Practices in Performance Management That Will ...
Common performance management problems include: Poor prioritizing and time management. Lack of efficiency.
Read more >
Four Steps for Addressing Performance Problems
The first question is a check to make sure that the problem is really a performance problem (the person isn't meeting expectations around...
Read more >
Managing Poor Performance: 5 Steps
Addressing poor performance at work is an incredibly valuable skill as a manager. We're here with a 5-step guide to helping employees improve....
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