"StyleCop cancelled" message

Jul 15, 2011 at 6:37 PM

When I run StyleCop on our solution it just gets going, processes about 50 files, halts briefly with VS spinning wheel hourglass, then aborts with the message "StyleCop cancelled" but no other indication what happened or why. The code errors & warnings found to that point are available. Sounds like a thread exception but nothing in the event log.

We have about 80 projects in our solution, mix of projects including ASP.NET MVC, class libraries, WCF services, databases, unit tests, coded UI tests, etc with MS Pex, Moles, SharePoint, NServiceBus, PostSharp libraries.

I tried an earlier version of StyleCop on the same solution, no different. I tried a different smaller solution and StyleCop worked fine. So it seems it is the specific solution but I'd rather use a log or exception trace rather than rip the solution apart to troubleshoot this.

Any suggestions?

We are running VS2010 SP1 on Win7 Enterprise SP1 with StyleCop latest version available, build 4.5.25.0.

Coordinator
Jul 16, 2011 at 10:19 AM
Did it get to over 1000 issues?
It'll stop as soon as it gets to that point to avoid just taking ages to complete.

The command line you can set your own limit but in VS it's 1000



On 15 Jul 2011, at 18:37, "johnmcalvert" <notifications@codeplex.com> wrote:

From: johnmcalvert

When I run StyleCop on our solution it just gets going, processes about 50 files, halts briefly with VS spinning wheel hourglass, then aborts with the message "StyleCop cancelled" but no other indication what happened or why. The code errors & warnings found to that point are available. Sounds like a thread exception but nothing in the event log.

We have about 80 projects in our solution, mix of projects including ASP.NET MVC, class libraries, WCF services, databases, unit tests, coded UI tests, etc with MS Pex, Moles, SharePoint, NServiceBus, PostSharp libraries.

I tried an earlier version of StyleCop on the same solution, no different. I tried a different smaller solution and StyleCop worked fine. So it seems it is the specific solution but I'd rather use a log or exception trace rather than rip the solution apart to troubleshoot this.

Any suggestions?

We are running VS2010 SP1 on Win7 Enterprise SP1 with StyleCop latest version available, build 4.5.25.0.

Jul 16, 2011 at 11:01 AM

I found various docs on the command line settings but nothing on the throttling of number of issues. Please indicate what the command line option is or point me to the docs.

On my machine it only takes a couple of secs for VS to hit the 1000 limit hence this limit is not practical. Suggest this be configurable even in VS, or raised to a much larger number.

If it is DYI, I would consider figuring out the dev setup if you would be so kind to point where in the SC code base this setting is located.

Suggest you change the Output message to clearly indicate this is the reason for the "cancel", otherwise it is not at all obvious.

Thanks

Coordinator
Jul 16, 2011 at 11:26 AM
Away from my pc at present but the msbuild task has it so have a look at the msbuild installed files.

A.



On 16 Jul 2011, at 11:01, "johnmcalvert" <notifications@codeplex.com> wrote:

From: johnmcalvert

I found various docs on the command line settings but nothing on the throttling of number of issues. Please indicate what the command line option is or point me to the docs.

On my machine it only takes a couple of secs for VS to hit the 1000 limit hence this limit is not practical. Suggest this be configurable even in VS, or raised to a much larger number.

If it is DYI, I would consider figuring out the dev setup if you would be so kind to point where in the SC code base this setting is located.

Suggest you change the Output message to clearly indicate this is the reason for the "cancel", otherwise it is not at all obvious.

Thanks

Jul 16, 2011 at 1:11 PM

Thanks for the pointer. In case anyone else wants this info, look in "C:\Program Files (x86)\MSBuild\StyleCop\v4.5\StyleCop.Targets" for:

  <!-- Define all new properties which do not need to have both StyleCop and SourceAnalysis variations. -->
  <PropertyGroup>
    <!-- Specifying 0 will cause StyleCop to use the default violation count limit.
         Specifying any positive number will cause StyleCop to use that number as the violation count limit.
         Specifying any negative number will cause StyleCop to allow any number of violations without limit. -->
    <StyleCopMaxViolationCount Condition="'$(StyleCopMaxViolationCount)' == ''">0</StyleCopMaxViolationCount>
  </PropertyGroup>
and
    <!-- Run the StyleCop MSBuild task. -->
    <StyleCopTask
      ProjectFullPath="$(MSBuildProjectDirectory)"
      SourceFiles="@(StyleCopFiles)"
      AdditionalAddinPaths="@(StyleCopAdditionalAddinPaths)"
      ForceFullAnalysis="$(StyleCopForceFullAnalysis)"
      DefineConstants="$(DefineConstants)"
      TreatErrorsAsWarnings="$(StyleCopTreatErrorsAsWarnings)"
      CacheResults="$(StyleCopCacheResults)"
      OverrideSettingsFile="$(StyleCopOverrideSettingsFile)"
      OutputFile="$(StyleCopOutputFile)"
      MaxViolationCount="$(StyleCopMaxViolationCount)"
            />


Jul 16, 2011 at 1:20 PM
Edited Jul 16, 2011 at 1:33 PM

This issue is already logged although the name of the config item was not clear. If my project team decides to adopt StyleCop we will consider helping make the change.

Developer
Jul 16, 2011 at 9:07 PM
johnmcalvert wrote:

On my machine it only takes a couple of secs for VS to hit the 1000 limit hence this limit is not practical. Suggest this be configurable even in VS, or raised to a much larger number.

Hi Jonh,

I'm terribly sorry for my curiosity, but just wonder what were the reasons to see over 1000 warnings?
Could you please describe your use case?

Is it about possibility to calculate all mistakes in a solution or what?

If you run StyleCop "per project" usually it's quite enough to see that the project already has 1000 violations, which usually means that the project doesn't follow chosen style and we need to deal somehow with this 1000 warnings (disable/reconfigure rules or begin rewriting the code).

It would be nice to know about your use case. Thank you!

Best regards,
Oleg Shuruev

Jul 16, 2011 at 10:06 PM

I want to eval StyleCop on an entire solution in one shot. Since my machine has the horsepower for it, this will be easier than manually running SC over individual projects and merging the error and output window data.

I want to summarize across the entire solution the types of issues found to assess whether there is enough value in what SC finds to warrent using it, and also which issues occur most frequently in different layers of the solution and from different devs. I'd like SC to run over the full gamat of the 80 solutions we have, rather than just the first 50 files or so. I will copy the contents of the Error window into Excel and let it slice and dice the data and produce some nice summary tables and graphs.

The 1000 issue limit is completely arbitrary, why limit anyone at this point instead of 2000 or 5000.

Developer
Jul 17, 2011 at 9:04 PM

I got it, thank you for the answer!

Best regards,
Oleg Shuruev

Jul 21, 2011 at 2:44 PM

I have the same problem.

 

Doesn't take more than a second to scan my entire project, and I get around a thousand warnings, and once I fix them I think I'm done, just to rescan and get a thousand more... And so on... It'd be nice to get an overview of the project.