JetBrains Rider 2024.1 Help

Code Inspection: Possible cyclic constructor call

Category

Potential Code Quality Issues

ID

ConstructorInitializerLoop

EditorConfig

resharper_constructor_initializer_loop_highlighting

Default severity

Warning

Language

C#

Requires SWA

No

Given the following (rather synthetic) code snippet

class Base { Base(int n) : this("") { } Base (string s) : this(0) { } }

calling any of the constructors will cause an eventual stack overflow as constructors call each other perpetually.

Last modified: 17 April 2024