分析代码时出现异常

时间:2017-10-02 10:02:07

标签: pvs-studio

使用PVS-Studio 6.18.23098分析某些代码时,我在PVS-Studio窗口中获得了以下堆栈跟踪:

Exception message:   0
 Sequence contains no elements  0
 Stack:    at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Utils.VariableValueInfo.VariableValueInfoWalker.GetJoinVariableValueInfo(SyntaxNode environmentNode, SyntaxNode node, VariableValueInfo prewVariableValueInfo, IEnumerable`1 lastVariableValueInfo, TypeRelationship typeRelationship) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Utils\VariableValueInfo.cs:line 1002  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Utils.VariableValueInfo.VariableValueInfoWalker.VisitConditionalExpression(ConditionalExpressionSyntax node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Utils\VariableValueInfo.cs:line 660  0
    at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker.Visit(SyntaxNode node)  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Utils.VariableValueInfo.VariableValueInfoWalker.VisitAssignmentExpression(AssignmentExpressionSyntax node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Utils\VariableValueInfo.cs:line 553  0
    at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker.DefaultVisit(SyntaxNode node)  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Utils.VariableValueInfo.VariableValueInfoWalker.VisitExpressionStatement(ExpressionStatementSyntax node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Utils\VariableValueInfo.cs:line 745  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Utils.VariableValueInfo.VariableValueInfoWalker.<>c__DisplayClass30_0.<VisitBlock>b__0() in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Utils\VariableValueInfo.cs:line 731  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Utils.VariableValueInfo.VariableValueInfoWalker.CommonFunctionForBlock(Ramification branch, Action action) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Utils\VariableValueInfo.cs:line 946  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Utils.VariableValueInfo.ParseFunction(SemanticModelAdapter model, SyntaxNode mainBlock) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Utils\VariableValueInfo.cs:line 433  0
    at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.SemanticModelAdapter.GetVariableValueInfo(SyntaxNode node, Boolean includeLastAssignment) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\SemanticModelAdapter.cs:line 814  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Utils.SyntaxNodeUtils.IsImmutableStateMethod(SemanticModelAdapter model, InvocationExpressionSyntax invocationExpression) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Utils\SyntaxNodeUtils.cs:line 300  0
    at ProgramVerificationSystems.PVSStudio.Core.VirtualValues.VirtualValuesUtils.ResetChangedVariables(SemanticModelAdapter model, InvocationExpressionSyntax invocation, VirtualValuesContainer container) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\VirtualValues\VirtualValuesUtils.cs:line 122  0
    at ProgramVerificationSystems.PVSStudio.Core.VirtualValues.VirtualValuesUtils.ResetChangedVariables(SemanticModelAdapter model, ExpressionSyntax expression, VirtualValuesContainer container) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\VirtualValues\VirtualValuesUtils.cs:line 112  0
    at ProgramVerificationSystems.PVSStudio.Core.VirtualValues.VirtualValuesProcessor.AfterProcessInvocation(InvocationExpressionSyntax invocation) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\VirtualValues\VirtualValuesProcessor.cs:line 1352  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.CommonVisit(Type typeRuleBase, SyntaxNode node, Action`2 actionVisitRule, Action callBaseVisit, Func`1 virtualProcessorBeforeAction, Action`1 virtualProcessorAfterAction, VisibleVariablesContainer visibleDeclarations) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 270  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.VisitInvocationExpression(InvocationExpressionSyntax node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 1022  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.<>c__DisplayClass38_0.<Visit>b__1() in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 302  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.CommonVisit(Type typeRuleBase, SyntaxNode node, Action`2 actionVisitRule, Action callBaseVisit, Func`1 virtualProcessorBeforeAction, Action`1 virtualProcessorAfterAction, VisibleVariablesContainer visibleDeclarations) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 263  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.Visit(SyntaxNode node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 303  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.<>c__DisplayClass37_0.<DefaultVisit>b__1() in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 295  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.DefaultVisit(SyntaxNode node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 296  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.<>c__DisplayClass110_0.<VisitExpressionStatement>b__1() in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 819  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.VisitExpressionStatement(ExpressionStatementSyntax node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 822  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.<>c__DisplayClass62_0.<VisitBlock>b__1() in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 468  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.VisitBlock(BlockSyntax node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 476  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.<>c__DisplayClass149_0.<VisitMethodDeclaration>b__2() in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 1110  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.VisitMethodDeclaration(MethodDeclarationSyntax node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 1112  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.<>c__DisplayClass73_0.<VisitClassDeclaration>b__4() in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 568  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.VisitClassDeclaration(ClassDeclarationSyntax node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 570  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.<>c__DisplayClass153_0.<VisitNamespaceDeclaration>b__1() in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 1135  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 1136  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.<>c__DisplayClass75_0.<VisitCompilationUnit>b__1() in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 581  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.VisitCompilationUnit(CompilationUnitSyntax node) in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 582  0
    at ProgramVerificationSystems.PVSStudio.Analyzer.Core.Walkers.CSharpRulesWalker.WalkFullTree() in D:\JenkinsProjects\Workspace\proj_PVS-Studio_Setup\WorkDir\PVS-Studio\PVS-Studio\Analyzer\Core\Walkers\CSharpRulesWalker.cs:line 76  0

我尝试尽可能减少代码,以获得最小的示例。 这是我能做的最小的例子,它引起了堆栈跟踪的出现。

class Class
{
    void MethodB(double value)
    {
        var a = 0;
        var b = 0;

        var (_, _) = (0 < 0) ? (a, b) : (b, a);
    }

    void MethodA(IInterface obj)
    {
        MethodB(obj.Property);
    }
}

interface IInterface
{
    double Property { get; }
}

这是一个已知的错误吗?

1 个答案:

答案 0 :(得分:0)

请不要将stackoverflow用作bugtracker。它违背了stackoverflow的精神。请写信给我们对类似问题的支持。

我向同事们提供了这个问题的描述。谢谢你的信息。