Skip to content

warning AD0001: Analyzer 'Roslynator.CSharp.Analysis.InvocationExpressionAnalyzer' threw an exception of type 'System.NullReferenceException' #937

@baal2000

Description

@baal2000

Product and Version Used:
Roslynator.CSharp.Analysis

Released versions: 4.1.1 and earlier

Actual Behavior:
A conditional operator similar to:

   boolean_value ? "ab" : 'c'

where "ab" is a string value and 'c' is a char value causes

warning AD0001: Analyzer 'Roslynator.CSharp.Analysis.InvocationExpressionAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'. 

Expected Behavior:

error RCS1198: Avoid unnecessary boxing of value type. 

Steps to Reproduce:
Try this case-specific repro: https://github.com/baal2000/RoslynatorAnalyzerNRE
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions