Skip to content

Relay command sg field keywords#1162

Draft
Avid29 wants to merge 3 commits intoCommunityToolkit:mainfrom
Avid29:relay-command-sg_field-keywords
Draft

Relay command sg field keywords#1162
Avid29 wants to merge 3 commits intoCommunityToolkit:mainfrom
Avid29:relay-command-sg_field-keywords

Conversation

@Avid29
Copy link
Contributor

@Avid29 Avid29 commented Feb 7, 2026

**Closes #1073 **

When the C# language version supports it, this change replaces the backing field for generated RelayCommands with an implicit field using the new field keyword.

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • Tested code with current supported SDKs
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

Other information

Technically, this is a breaking change since someone may have been using the backing fields for whatever reason

@Avid29
Copy link
Contributor Author

Avid29 commented Feb 7, 2026

Sorry. This PR is horribly named, but GitHub isn't letting me edit for some reason

@Avid29 Avid29 marked this pull request as draft February 7, 2026 04:12
@Avid29
Copy link
Contributor Author

Avid29 commented Feb 7, 2026

Some tests are failing. It appears to be because they test that both the field and property is generated, except now a field is no longer always generated.

For example: Test_ObservableProperty_CommandNamesThatCantBeLowered and Test_RelayCommandAttribute_WithPartialCommandMethodDefinitions both fit this group of tests

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.

Use field keyword on generated relay commands

1 participant