Skip to content

Rename FieldValueReference.field to avoid the C# 14 'field' keyword - #419

Open
csm101 wants to merge 1 commit into
mono:mainfrom
csm101:fix/csharp14-field-keyword
Open

Rename FieldValueReference.field to avoid the C# 14 'field' keyword#419
csm101 wants to merge 1 commit into
mono:mainfrom
csm101:fix/csharp14-field-keyword

Conversation

@csm101

@csm101 csm101 commented Aug 20, 2026

Copy link
Copy Markdown

Summary

  • Mono.Debugging.Soft/FieldValueReference.cs has a private member named field that is used inside the Name, Type, DeclaringType and Value property accessors.
  • Starting with C# 14 (the default language version when targeting net10.0), field is a contextual keyword inside property accessors and denotes the compiler-generated backing field, so the project fails to build with 10 CS1061/CS1503 errors (e.g. 'string' does not contain a definition for 'Name').
  • This renames the member to fieldInfo. Constructor and helper parameters keep their names (they are not affected). No behavior change.

Consumers that build these sources with a newer TFM currently have to pin LangVersion to 13; with this change they no longer need to.

Test plan

  • Mono.Debugger.Soft, Mono.Debugging, Mono.Debugging.Soft build with TargetFrameworks=net10.0 (C# 14) on .NET SDK 10.0.301
  • Still builds with the repository defaults (net6.0;net472)
  • Smoke-tested against a .NET for Android (MonoVM) app: attach, breakpoint hit, locals/fields read correctly

🤖 Generated with Claude Code

Starting with C# 14 (the default language version for net10.0), 'field' is a
contextual keyword inside property accessors and refers to the compiler-
generated backing field. FieldValueReference uses a private member named
'field' inside its Name, Type, DeclaringType and Value accessors, so building
Mono.Debugging.Soft with LangVersion 14 fails with CS1061/CS1503 errors.

Rename the member to 'fieldInfo'. No behavior change; constructor and helper
parameters keep their names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 20, 2026 11:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Renames FieldValueReference’s private member from field to fieldInfo to avoid the new C# 14 contextual keyword field within property accessors (important when building with net10.0 / C# 14), without changing runtime behavior.

Changes:

  • Renamed the private FieldInfoMirror field member to fieldInfo.
  • Updated all property accessor and method usages to reference fieldInfo instead of field.
  • Left constructor parameters named field unchanged (safe outside property-accessor context).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@csm101

csm101 commented Aug 20, 2026

Copy link
Copy Markdown
Author

@dotnet-policy-service agree company="MCA Software s.a.s. di Sirna Carlo &C."

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.

2 participants