Skip to content

Analyzer throws System.NullReferenceException for short syntax of record types #3272

Closed
@artemsnezhny

Description

C# 9 supports short declaration form for record types, example:
public sealed record QueueCount(int Count);

But in this case the analyzer throw following:

AD0001	Analyzer 'StyleCop.Analyzers.LayoutRules.SA1502ElementMustNotBeOnASingleLine' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'
AD0001	Analyzer 'StyleCop.Analyzers.LayoutRules.SA1508ClosingBracesMustNotBePrecededByBlankLine' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.
AD0001	Analyzer 'StyleCop.Analyzers.LayoutRules.SA1500BracesForMultiLineStatementsMustNotShareLine' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'

In the same time for the full form this is fine

public sealed record WorkQueueCount
{
    public int Count { get; init; }
}

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions