dotnet / roslyn-analyzers

MIT License
1.6k stars 468 forks source link

CA1303 Hang #2790

Open nnpcYvIVl opened 5 years ago

nnpcYvIVl commented 5 years ago

In a build pipeline I run analyzers from Microsoft.NetCore.Analyzers.dll. One particular solution always hangs, when I capture a memory dump it is stuck in CA1303 DoNotPassLiteralsAsLocalizedParameters.

I am using version 2.9.4. See attached stacktrace.

Thread 6 - System ID 13720

Entry point   clr!LogHelp_LogAssert+6840 
Create time   8/26/2019 2:48:48 PM 
Time spent in user mode   0 Days 17:31:13.203 
Time spent in kernel mode   0 Days 00:02:43.859 

This thread is enumerating a System.Collections.Generic.Dictionary object

.NET Call Stack

[[HelperMethodFrame]] 
Analyzer.Utilities.Extensions.IEnumerableExtensions.OrderBy[[System.Int32, mscorlib]](System.Collections.Generic.IEnumerable`1, System.Collections.Generic.IComparer`1)+7f 
Analyzer.Utilities.Extensions.IEnumerableExtensions.Order[[System.Int32, mscorlib]](System.Collections.Generic.IEnumerable`1)+95 
Analyzer.Utilities.HashUtilities.Combine[[System.__Canon, mscorlib]](System.Collections.Immutable.ImmutableHashSet`1, Int32)+120 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.PointsToAnalysis.PointsToAbstractValue.ComputeHashCodeParts(Analyzer.Utilities.PooledObjects.ArrayBuilder`1)+6f 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.CacheBasedEquatable`1[[System.__Canon, mscorlib]].ComputeHashCodeParts()+30 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.CacheBasedEquatable`1[[System.__Canon, mscorlib]].GetOrComputeHashCode()+35 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.AnalysisEntity.ComputeHashCodeParts(Analyzer.Utilities.PooledObjects.ArrayBuilder`1)+1b 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.CacheBasedEquatable`1[[System.__Canon, mscorlib]].ComputeHashCodeParts()+30 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.CacheBasedEquatable`1[[System.__Canon, mscorlib]].GetOrComputeHashCode()+35 
mscorlib_ni!System.Collections.Generic.GenericEqualityComparer`1[[System.__Canon, mscorlib]].GetHashCode(System.__Canon)+17 
mscorlib_ni!System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].FindEntry(System.__Canon)+61 
mscorlib_ni!System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].TryGetValue(System.__Canon, System.__Canon ByRef)+15 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.AnalysisEntityMapAbstractDomain`1[[System.__Canon, mscorlib]].Merge(Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.DictionaryAnalysisData`2, Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.DictionaryAnalysisData`2)+576 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.AnalysisEntityBasedPredicateAnalysisData`1[[System.__Canon, mscorlib]]..ctor(Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.AnalysisEntityBasedPredicateAnalysisData`1, Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.AnalysisEntityBasedPredicateAnalysisData`1, Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.MapAbstractDomain`2)+51 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.ValueContentAnalysis.ValueContentAnalysisData.WithMergedData(Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.AnalysisEntityBasedPredicateAnalysisData`1, Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.MapAbstractDomain`2)+50 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.PredicatedAnalysisDataDomain`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].Merge(System.__Canon, System.__Canon)+79 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.DataFlowAnalysis`5[[System.__Canon, mscorlib],[System.__Canon, mscorlib],[System.__Canon, mscorlib],[System.__Canon, mscorlib],[System.__Canon, mscorlib]].RunCore(Microsoft.CodeAnalysis.FlowAnalysis.ControlFlowGraph, System.Collections.Generic.SortedSet`1, System.Collections.Generic.SortedSet`1, System.__Canon, Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.DataFlowAnalysisResultBuilder`1, Analyzer.Utilities.PooledObjects.PooledHashSet`1, Analyzer.Utilities.PooledObjects.PooledDictionary`2>, Analyzer.Utilities.PooledObjects.PooledDictionary`2, Analyzer.Utilities.PooledObjects.PooledDictionary`2, Analyzer.Utilities.PooledObjects.PooledDictionary`2>>, Analyzer.Utilities.PooledObjects.PooledDictionary`2, Boolean)+c4a 
Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.DataFlowAnalysis`5[[System.__Canon, mscorlib],[System.__Canon, mscorlib],[System.__Canon, mscorlib],[System.__Canon, mscorlib],[System.__Canon, mscorlib]].Run(System.__Canon)+456 
Analyzer.Utilities.SingleThreadedConcurrentDictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].GetOrAdd(System.__Canon, System.Func`2)+199 
Microsoft.NetCore.Analyzers.Runtime.DoNotPassLiteralsAsLocalizedParameters+<>c__DisplayClass7_1.g__ComputeValueContentAnalysisResult|6()+29c 
mscorlib_ni!System.Lazy`1[[System.__Canon, mscorlib]].CreateValue()+f3 
mscorlib_ni!System.Lazy`1[[System.__Canon, mscorlib]].LazyInitValue()+1a0 
Microsoft.NetCore.Analyzers.Runtime.DoNotPassLiteralsAsLocalizedParameters+<>c__DisplayClass7_1.g__AnalyzeArgument|5(Microsoft.CodeAnalysis.IParameterSymbol, Microsoft.CodeAnalysis.IPropertySymbol, Microsoft.CodeAnalysis.IOperation, System.Action`1)+9b 
Microsoft.NetCore.Analyzers.Runtime.DoNotPassLiteralsAsLocalizedParameters+<>c__DisplayClass7_1.b__2(Microsoft.CodeAnalysis.Diagnostics.OperationAnalysisContext)+171 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor+<>c.b__51_0(System.ValueTuple`2,Microsoft.CodeAnalysis.Diagnostics.OperationAnalysisContext>)+66 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[[System.ValueTuple`2[[System.__Canon, mscorlib],[Microsoft.CodeAnalysis.Diagnostics.OperationAnalysisContext, Microsoft.CodeAnalysis]], mscorlib]](Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, System.Action`1>, System.ValueTuple`2, System.Nullable`1)+b1 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows[[System.ValueTuple`2[[System.__Canon, mscorlib],[Microsoft.CodeAnalysis.Diagnostics.OperationAnalysisContext, Microsoft.CodeAnalysis]], mscorlib]](Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, System.Action`1>, System.ValueTuple`2, System.Nullable`1)+1d0 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteOperationAction(Microsoft.CodeAnalysis.Diagnostics.OperationAnalyzerAction, Microsoft.CodeAnalysis.IOperation, Microsoft.CodeAnalysis.ISymbol, Microsoft.CodeAnalysis.SemanticModel, System.Action`1, System.Func`2, OperationAnalyzerStateData)+2e8 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteOperationActions(Microsoft.CodeAnalysis.IOperation, System.Collections.Generic.IDictionary`2>, Microsoft.CodeAnalysis.ISymbol, Microsoft.CodeAnalysis.SemanticModel, System.Action`1, System.Func`2, OperationAnalyzerStateData)+d6 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteOperationActions(System.Collections.Generic.IEnumerable`1, System.Collections.Generic.IDictionary`2>, Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, Microsoft.CodeAnalysis.ISymbol, Microsoft.CodeAnalysis.SemanticModel, System.Action`1, System.Func`2, OperationAnalyzerStateData)+134 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteBlockActionsCore[[System.__Canon, mscorlib],[System.__Canon, mscorlib],[System.__Canon, mscorlib],[System.__Canon, mscorlib],[System.__Canon, mscorlib],[System.Int32, mscorlib]](System.Collections.Generic.IEnumerable`1, System.Collections.Generic.IEnumerable`1, System.Collections.Generic.IEnumerable`1, Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, Microsoft.CodeAnalysis.SyntaxNode, Microsoft.CodeAnalysis.ISymbol, System.Collections.Immutable.ImmutableArray`1, System.Func`2,System.Collections.Generic.IEnumerable`1>, Microsoft.CodeAnalysis.SemanticModel, System.Func`2, BlockAnalyzerStateData`2, Boolean)+dd3 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.TryExecuteOperationBlockActions(System.Collections.Generic.IEnumerable`1, System.Collections.Generic.IEnumerable`1, System.Collections.Generic.IEnumerable`1, Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, Microsoft.CodeAnalysis.SyntaxNode, Microsoft.CodeAnalysis.ISymbol, System.Collections.Immutable.ImmutableArray`1, System.Collections.Immutable.ImmutableArray`1, Microsoft.CodeAnalysis.SemanticModel, Microsoft.CodeAnalysis.SyntaxReference, Int32, Microsoft.CodeAnalysis.Diagnostics.AnalysisScope, Microsoft.CodeAnalysis.Diagnostics.AnalysisState, Boolean)+150 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver`1+<>c__DisplayClass14_0[[Microsoft.CodeAnalysis.CSharp.SyntaxKind, Microsoft.CodeAnalysis.CSharp]].g__executeOperationsBlockActions|7(System.Collections.Immutable.ImmutableArray`1, System.Collections.Immutable.ImmutableArray`1, System.Collections.Generic.IEnumerable`1>)+1b8 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver`1+<>c__DisplayClass14_0[[Microsoft.CodeAnalysis.CSharp.SyntaxKind, Microsoft.CodeAnalysis.CSharp]].g__executeExecutableCodeActions|3()+165 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver`1[[Microsoft.CodeAnalysis.CSharp.SyntaxKind, Microsoft.CodeAnalysis.CSharp]].TryExecuteDeclaringReferenceActions(Microsoft.CodeAnalysis.SyntaxReference, Int32, Microsoft.CodeAnalysis.Diagnostics.SymbolDeclaredCompilationEvent, Microsoft.CodeAnalysis.Diagnostics.AnalysisScope, Microsoft.CodeAnalysis.Diagnostics.AnalysisState, GroupedAnalyzerActions, Boolean, Boolean, Boolean, Boolean, Boolean, System.Threading.CancellationToken)+2db 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver`1[[Microsoft.CodeAnalysis.CSharp.SyntaxKind, Microsoft.CodeAnalysis.CSharp]].TryExecuteDeclaringReferenceActions(Microsoft.CodeAnalysis.Diagnostics.SymbolDeclaredCompilationEvent, Microsoft.CodeAnalysis.Diagnostics.AnalysisScope, Microsoft.CodeAnalysis.Diagnostics.AnalysisState, Boolean, Microsoft.CodeAnalysis.Diagnostics.AnalyzerActions, System.Threading.CancellationToken)+32c 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver+d__92.MoveNext()+2c9 
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib]].Start[[Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver+d__92, Microsoft.CodeAnalysis]](d__92 ByRef)+7a 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver.TryProcessSymbolDeclaredAsync(Microsoft.CodeAnalysis.Diagnostics.SymbolDeclaredCompilationEvent, Microsoft.CodeAnalysis.Diagnostics.AnalysisScope, Microsoft.CodeAnalysis.Diagnostics.AnalysisState, System.Threading.CancellationToken)+95 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver+d__91.MoveNext()+bf 
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib]].Start[[Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver+d__91, Microsoft.CodeAnalysis]](d__91 ByRef)+7a 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver.TryProcessEventCoreAsync(Microsoft.CodeAnalysis.Diagnostics.CompilationEvent, Microsoft.CodeAnalysis.Diagnostics.AnalysisScope, Microsoft.CodeAnalysis.Diagnostics.AnalysisState, System.Threading.CancellationToken)+95 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver+d__89.MoveNext()+7c 
System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver+d__89, Microsoft.CodeAnalysis]](d__89 ByRef)+80 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver.ProcessEventAsync(Microsoft.CodeAnalysis.Diagnostics.CompilationEvent, Microsoft.CodeAnalysis.Diagnostics.AnalysisScope, Microsoft.CodeAnalysis.Diagnostics.AnalysisState, System.Threading.CancellationToken)+8b 
Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver+d__88.MoveNext()+2ad 
mscorlib_ni!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+172 
mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+15 
mscorlib_ni!System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()+6f 
mscorlib_ni!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)+63 
mscorlib_ni!System.Threading.Tasks.Task.FinishContinuations()+400 
mscorlib_ni!System.Threading.Tasks.Task`1[[System.__Canon, mscorlib]].TrySetResult(System.__Canon)+68 
mscorlib_ni!System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib]].TrySetFromTask(System.Threading.Tasks.Task, Boolean)+1e5 
mscorlib_ni!System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib]].ProcessInnerTask(System.Threading.Tasks.Task)+5f 
mscorlib_ni!System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib]].ProcessCompletedOuterTask(System.Threading.Tasks.Task)+b7 
mscorlib_ni!System.Threading.Tasks.UnwrapPromise`1[[System.__Canon, mscorlib]].Invoke(System.Threading.Tasks.Task)+3c 
mscorlib_ni!System.Threading.Tasks.Task.FinishContinuations()+447 
mscorlib_ni!System.Threading.Tasks.Task.Finish(Boolean)+34 
mscorlib_ni!System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)+257 
mscorlib_ni!System.Threading.Tasks.Task.ExecuteEntry(Boolean)+a1 
mscorlib_ni!System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task, Boolean)+32 
mscorlib_ni!System.Threading.Tasks.TaskScheduler.TryRunInline(System.Threading.Tasks.Task, Boolean)+1a6 
mscorlib_ni!System.Threading.Tasks.TaskContinuation.InlineIfPossibleOrElseQueue(System.Threading.Tasks.Task, Boolean)+76 
mscorlib_ni!System.Threading.Tasks.Task.FinishContinuations()+fe 
mscorlib_ni!System.Threading.Tasks.Task`1[[System.__Canon, mscorlib]].TrySetResult(System.__Canon)+68 
mscorlib_ni!System.Threading.Tasks.TaskCompletionSource`1[[System.__Canon, mscorlib]].TrySetResult(System.__Canon)+15 
mscorlib_ni!System.Threading.Tasks.TaskCompletionSource`1[[System.__Canon, mscorlib]].SetResult(System.__Canon)+b 
mscorlib_ni!System.Threading.Tasks.Task.Execute()+47 
mscorlib_ni!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+172 
mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+15 
mscorlib_ni!System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)+231 
mscorlib_ni!System.Threading.Tasks.Task.ExecuteEntry(Boolean)+a1 
mscorlib_ni!System.Threading.ThreadPoolWorkQueue.Dispatch()+156 
[[DebuggerU2MCatchHandlerFrame]] 
mavasani commented 5 years ago

@nnpcYvIVl Do you have a repro project that I can try this on?

nnpcYvIVl commented 5 years ago

@mavasani Sorry, no repro at the moment.

vbaderks commented 5 years ago

I am in the process of upgrading our NuGet package from 2.9.3 to 2.9.4 and also have discovered that after upgrading the C# compiler hangs. But this doesn't apply to all our .csproj projects, some work fine and everthing is working oke with 2.9.3. C# version = 3.2.1-beta4-19408-03 (2fc6a049)

I am now upgrading project for project to see when the problems occurs.

vbaderks commented 5 years ago

Update: I have brought the problem down to 1 project. Any tips on how to log which .cs file / line is being processed?

mavasani commented 5 years ago

@vbaderks If you are able to capture a heap dump, then the thread which has the analyzer name DoNotPassLiteralsAsLocalizedParameters should contain the symbol and the name of the current method being analyzed.

vbaderks commented 5 years ago

Hi @mavasani,

When I run msbuild on the project it always hangs. When I attach Visual Studio to the VBCCompiler.exe process I don't see a thread with the name DoNotPassLiteralsAsLocalizedParameters. On my system there are 3 managed threads (Main Thread and 2 Workers threads). The thread that is in a loop and processing CPU cycles is just called "Worker Thread". The call stack does however looks like the one above.

I tried to add a VBCCompiler.ini file to get better debug info, but at this moment I can only see the call stack but no variables (with VS 2019 as debugger) which could help to understand which method is being analyzed.

vbaderks commented 5 years ago

I just updated to "v2.9.5-beta1.final", the "hang" I was seeing has been resolved with this version.

nnpcYvIVl commented 5 years ago

My project still hangs with v2.9.5-beta1.final.

dougwaldron commented 5 years ago

I am experiencing the same issue in a project using versions 2.9.3 or 2.9.6 (latest). VBCSCompiler maxes out CPU and memory. Even after canceling build and closing Visual Studio, VBCSCompiler continues to run and has to be force quit (see screenshots).

Disabling CA1303 in GlobalSuppressions.vb and/or .editorconfig has no effect; I have to create a ruleset file with <Rule Id="CA1303" Action="None" /> in order to proceed. FYI, my project has >3100 violations of CA1303.

During build: image

After canceling build and closing Visual Studio: image

mavasani commented 5 years ago

@guitarzan Would you be able to provide a repro that we can use to investigate?

mavasani commented 5 years ago

Disabling CA1303 in GlobalSuppressions.vb and/or .editorconfig has no effect; I have to create a ruleset file with in order to proceed. FYI, my project has >3100 violations of CA1303.

We are hoping to fix the .editorconfig suppression to prevent running the analyzer in 16.4, so the performance characteristics would be identical when disabled in .editorconfig file or ruleset.

dougwaldron commented 5 years ago

@guitarzan Would you be able to provide a repro that we can use to investigate?

Sorry, no repro. It's only one very large project that has this problem, and I can't tell where the problem originates. If you have steps I could follow, I'm willing to help if I can.

Evangelink commented 4 years ago

@guitarzan are you still experiencing the issue with the latest version?

stesee commented 4 years ago

Same problem here, I can reproduce the behaviour with dotnet-cli (ubuntu & windows) and Visual Studio. A project with this behaviour can be found at https://github.com/Codeuctivity/Open-Xml-PowerTools/blob/vNext/OpenXmlPowerTools/OpenXmlPowerTools.csproj

dougwaldron commented 4 years ago

This may not be a conclusive test since I'm now running VS in Parallels on an older Mac, and even a normal build seems to max out the CPU for a while, but I just tried removing the rule disabling CA1303 from my ruleset file and had the same issue -- build never finished & VBCSCompiler continued to run after canceling build and closing VS.

I'm currently on VS 16.5.2 and version 2.9.8 of the analyzers (latest stable).

dougwaldron commented 4 years ago

FYI, still an issue on VS 16.7.2 and Microsoft.CodeAnalysis.FxCopAnalyzers 3.3.0.

By the way, not sure if this makes a difference, but my project is on .NET Framework 4.5.2. I just noticed the OP mentioned Microsoft.NetCore.Analyzers.

Evangelink commented 4 years ago

@stesee I am having some trouble reproducing the issue with the project you have pointed to. Whether or not I enable the CA1303 rule I can't see any difference. What are you doing to be able to reproduce the issue?

stesee commented 4 years ago

@Evangelink : Microsoft.CodeAnalysis.FxCopAnalyzers was disabled after hanging issues in https://github.com/Codeuctivity/Open-Xml-PowerTools/blob/master/OpenXmlPowerTools/OpenXmlPowerTools.csproj

See https://github.com/Codeuctivity/Open-Xml-PowerTools/blob/f95d72c216ac0bd8bec46a46e8737f6f44eab45a/OpenXmlPowerTools/OpenXmlPowerTools.csproj#L51

I validated that the issue is still there with "Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0" and VS 16.7.5

Evangelink commented 4 years ago

Thanks, I didn't see that this project was excluding the analyzer.

I have done various run and I cannot reproduce the build hanging but I confirm that by enabling the fxcop analyzers on OpenXmlPowerTools project we move from around 40s of build time to 2m40s but the build does finish properly. For the record there is nearly 4500 issues.

I have also tried to re-enable the nullable option and there is still no hanging problem with the build.

Lastly, I have tried to disable the rule CA1303 in the .editorconfig file and it doesn't seem to be affecting much the build time so if there is a rule slowing down the process it shouldn't be this one.

stesee commented 4 years ago

You are right. The build is not hanging, it is just unexpected slow. My slow pet project dev machine went from 4:34 to 22:59 build time after enabling Microsoft.CodeAnalysis.FxCopAnalyzers 3.3.0. I also took a second look at Microsoft.CodeAnalysis.FxCopAnalyzers 2.9.8 and killed the build after 60+ minutes.

@nnpcYvIVl can you upgrade Microsoft.CodeAnalysis.FxCopAnalyzers and prove that your build isn't just realy realy slow?

Evangelink commented 4 years ago

I agree that the build becomes really slow but when looking at the number of issues found I don't really know if that's so bad (@sharwell any opinion?).

@stesee I would personally disable most of the rules that are reporting a lot of issues and slowly enable them (i.e. do a PR enabling rule X and fixing or skipping the issues found by rule X then repeat with rule Y). Because when you are seeing a lot of issues you tend to somehow get used to them and so not to do the required changes which means you are better of without the analyzers. When living in the noise we get used to it and start ignoring it.

stesee commented 4 years ago

Yes, that code needs a big portion of love. I am not sure if I have that much love (time) to spare. Great that 3.3.0 produces any output at least I could work on.

mavasani commented 4 years ago

I will investigate this issue, this is likely due to the fact that this rule runs with inter procedural data flow analysis.