Rename FieldValueReference.field to avoid the C# 14 'field' keyword - #419
Open
csm101 wants to merge 1 commit into
Open
Rename FieldValueReference.field to avoid the C# 14 'field' keyword#419csm101 wants to merge 1 commit into
csm101 wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
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 fieldmember tofieldInfo. - Updated all property accessor and method usages to reference
fieldInfoinstead offield. - Left constructor parameters named
fieldunchanged (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.
Author
|
@dotnet-policy-service agree company="MCA Software s.a.s. di Sirna Carlo &C." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mono.Debugging.Soft/FieldValueReference.cshas a private member namedfieldthat is used inside theName,Type,DeclaringTypeandValueproperty accessors.net10.0),fieldis a contextual keyword inside property accessors and denotes the compiler-generated backing field, so the project fails to build with 10CS1061/CS1503errors (e.g.'string' does not contain a definition for 'Name').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
LangVersionto 13; with this change they no longer need to.Test plan
Mono.Debugger.Soft,Mono.Debugging,Mono.Debugging.Softbuild withTargetFrameworks=net10.0(C# 14) on .NET SDK 10.0.301net6.0;net472)🤖 Generated with Claude Code