Skip to content

Replace dead _complexity backing field with nullable auto-property (CS0414)#230

Open
wrigjl wants to merge 1 commit into
ReduxISU:CSharpAPIfrom
wrigjl:fix/complexity-nullable-property
Open

Replace dead _complexity backing field with nullable auto-property (CS0414)#230
wrigjl wants to merge 1 commit into
ReduxISU:CSharpAPIfrom
wrigjl:fix/complexity-nullable-property

Conversation

@wrigjl
Copy link
Copy Markdown
Collaborator

@wrigjl wrigjl commented May 31, 2026

Summary

Ten reduction/verifier classes declared `private string _complexity = ""` but never wired up a public `complexity` property, causing two problems:

  • CS0414 build warnings (field assigned, value never read)
  • Silent omission of `complexity` from API responses, even though other classes expose it

Replaced with a nullable auto-property decorated with `[JsonIgnore]` in all affected classes:

```csharp
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? complexity { get; set; } = null;
```

`null` is an explicit "not specified" sentinel. The `[JsonIgnore]` attribute means the field is omitted from the JSON response when null, keeping the API surface clean until a real value is provided. Also adds the property to the Reduction and Solver scaffolding templates so new classes get it by default.

Not included (blocked by other open PRs)

Test plan

  • `dotnet build` produces no CS0414 warnings in the 10 affected files
  • `/reduce` responses for affected reductions omit the `complexity` field entirely (not present, not null)

🤖 Generated with Claude Code

Ten reduction/verifier classes declared `private string _complexity = ""`
but never exposed it via a public property, producing CS0414 warnings and
silently omitting complexity from API responses. Replaced with:

    public string? complexity { get; set; } = null;

Null is an explicit "not specified" sentinel, giving callers a consistent
JSON shape. Also adds the property to the Reduction and Solver scaffolding
templates so new classes get it by default.

Remaining: KarpGraphColorToExactCover.cs and ProblemVerifier.txt are
blocked on PRs ReduxISU#215 and ReduxISU#217 respectively.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant