Compiling some projects (not all) results in this analyzer taking a significant amount of time, significantly slowing the build.
In nike4613/MahoyoHDRepack, Microsoft.NetCore.Analyzers.Runtime.DisposeObjectsBeforeLosingScope (CA2000) = 46.933 s out of 53.751 s, according to -p:ReportAnalyzer=true.
In MonoMod/MonoMod's reorganize branch, Microsoft.NetCore.Analyzers.Runtime.DisposeObjectsBeforeLosingScope (CA2000) = 44.569 s out of 48.363 s for just one TFM build of the MonoMod.Utils project.
I ran a PerfView trace of the build, and am seeing quite a lot of exceptions thrown from Microsoft.CodeAnalysis.DataFlow.DataFlowOperationVisitor``4.VisitInvocation_LambdaOrDelegateOrLocalFunction, which seem to take quite a lot of time:
InvalidCastException: Unable to cast object of type 'System.Byte' to type 'System.String'
Apparently not from the same method, there are also a lot of ArgumentOutOfRangeExceptions which are being thrown, though I cannot get a good idea of where because the stack traces are broken in my trace. There are also several other failed casts, though I am unsure if they are related to this analyzer.
Analyzer
DisposeObjectsBeforeLosingScope
Analyzer source
SDK: Built-in CA analyzers in .NET 8 SDK
Version: SDK 8.0.100
Describe the bug
Compiling some projects (not all) results in this analyzer taking a significant amount of time, significantly slowing the build.
Microsoft.NetCore.Analyzers.Runtime.DisposeObjectsBeforeLosingScope (CA2000) = 46.933 s
out of 53.751 s, according to-p:ReportAnalyzer=true
.reorganize
branch,Microsoft.NetCore.Analyzers.Runtime.DisposeObjectsBeforeLosingScope (CA2000) = 44.569 s
out of 48.363 s for just one TFM build of theMonoMod.Utils
project.I ran a PerfView trace of the build, and am seeing quite a lot of exceptions thrown from
Microsoft.CodeAnalysis.DataFlow.DataFlowOperationVisitor``4.VisitInvocation_LambdaOrDelegateOrLocalFunction
, which seem to take quite a lot of time:InvalidCastException: Unable to cast object of type 'System.Byte' to type 'System.String'
Apparently not from the same method, there are also a lot of
ArgumentOutOfRangeException
s which are being thrown, though I cannot get a good idea of where because the stack traces are broken in my trace. There are also several other failed casts, though I am unsure if they are related to this analyzer.