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.

AD0001 Analyzer 'FakeItEasy.Analyzer.UnusedReturnValueAnalyzer' threw an exception

See original GitHub issue

I was trying out https://www.nuget.org/packages/FakeItEasy.Analyzer/ and got a bunch of warnings, all in the same style. The SyntaxNode exists, but isn’t called in any way by FakeItEasy (A.…) code.

Don’t know if you guys can make something of this, if not then close as I wont be spending time analyzing this further.

Severity    Code    Description Project File    Line    Source  Suppression State   Detail Description
Warning AD0001  Analyzer 'FakeItEasy.Analyzer.UnusedReturnValueAnalyzer' threw an exception of type 'System.ArgumentNullException' with message 'Value cannot be null.
Parameter name: syntax'.    <Project>       1   IntelliSense    Active  Analyzer 'FakeItEasy.Analyzer.UnusedReturnValueAnalyzer' threw the following exception:
'Exception occurred with following context:
Compilation: <Project>
SyntaxTree: C:\Source\<Project>\AnalyzerTests.cs
SyntaxNode: CreateId() [InvocationExpressionSyntax]@[4016..4026) (118,46)-(118,56)

System.ArgumentNullException: Value cannot be null.
Parameter name: syntax
   at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.CheckSyntaxNode(CSharpSyntaxNode syntax)
   at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.GetSymbolInfo(ExpressionSyntax expression, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetSymbolInfo(SemanticModel semanticModel, ExpressionSyntax expression, CancellationToken cancellationToken)
   at FakeItEasy.Analyzer.UnusedReturnValueAnalyzer.GetCalledMethodSymbol(InvocationExpressionSyntax call, SyntaxNodeAnalysisContext context)
   at FakeItEasy.Analyzer.UnusedReturnValueAnalyzer.AnalyzeCall(SyntaxNodeAnalysisContext context)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass42_1`1.<ExecuteSyntaxNodeAction>b__1()
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock(DiagnosticAnalyzer analyzer, Action analyze, Nullable`1 info)
-----
'.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
adamralphcommented, May 29, 2016

@Mertsch OK, thanks. I’ve managed to reproduce it now. The use of JetBrains.Annotations appears to be irrelevant:

  1. Create a class library
  2. Install-Package FakeItEasy.Analyzer
  3. Add this code:
    public class Foo
    {
        public void Bar()
        {
            Baz();
        }

        public void Baz()
        {
        }
    }
1reaction
blairconradcommented, Jun 20, 2016

This issue has been fixed in release 2.1.0.

Thanks for your help, @Mertsch. Look for your name in the release notes! 🏆

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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