Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix analyzer [RCS1194](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1194) ([PR](https://github.com/dotnet/roslynator/pull/1733))

## [4.15.0] - 2025-12-14

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ private static void AnalyzeNamedType(SymbolAnalysisContext context, INamedTypeSy

var classDeclaration = (ClassDeclarationSyntax)symbol.GetSyntax(context.CancellationToken);

#if ROSLYN_4_0
if (classDeclaration.ParameterList is not null)
return;
#endif

DiagnosticHelpers.ReportDiagnostic(context, DiagnosticRules.ImplementExceptionConstructors, classDeclaration.Identifier);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ public C(string message, Exception innerException) : base(message, innerExceptio
{
}
}
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.ImplementExceptionConstructors)]
public async Task Test_PrimaryConstructor()
{
await VerifyNoDiagnosticAsync(@"
using System;
class MyException (string message) : Exception(message);
");
}
}
Loading