KEMBAR78
Radio Button Null Selection Fix by asi-evin · Pull Request #31175 · dotnet/maui · GitHub
Skip to content

Conversation

@asi-evin
Copy link
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

Allows Radio Button group controller Value to be set to null. This can clear radio button(s) that have been selected.

Issues Fixed

Fixes #19437

@asi-evin asi-evin requested a review from a team as a code owner August 14, 2025 17:13
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Aug 14, 2025
@asi-evin
Copy link
Contributor Author

@asi-evin please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree

@asi-evin asi-evin changed the title Fix 19437 Radio Button Null Selection Fix Aug 15, 2025
@jfversluis
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

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

Looks like we have a failing unit test: Microsoft.Maui.Controls.Core.UnitTests.RadioButtonTests.ImpliedGroupDoesNotIncludeExplicitGroups

@asi-evin
Copy link
Contributor Author

asi-evin commented Aug 19, 2025

I noticed. Some observations:

  • if I run the unit test by itself, it passes.
  • if I set a value for radio button 3 like so, it passes:
image - Edit: If I change the groupname to "bar", ity passes.

@jfversluis I've been trying to debug, but would appreciate some wisdom if it's available.

@asi-evin
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 31175 in repo dotnet/maui

@asi-evin asi-evin requested a review from jfversluis August 19, 2025 17:07
@jfversluis
Copy link
Member

jfversluis commented Aug 20, 2025

/azp run MAUI-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

jfversluis commented Aug 21, 2025

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

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

Unfortunately some failing UI tests still. Unit tests look OK now!

@asi-evin
Copy link
Contributor Author

@jfversluis How do I run these UI tests locally? I can't seem to figure out how to run them.

@MartyIX
Copy link
Contributor

MartyIX commented Aug 22, 2025

@jfversluis How do I run these UI tests locally? I can't seem to figure out how to run them.

https://github.com/dotnet/maui/wiki/UITests#running-from-visual-studio-code-requires-c-dev-kit-with-net-maui-extension-installed

I simply run Controls.TestCases.HostApp in my Visual Studio, type the issue number in the application that pops up, and then the test is run.

@asi-evin asi-evin requested a review from jfversluis August 22, 2025 15:45
@asi-evin
Copy link
Contributor Author

@jfversluis How do I run these UI tests locally? I can't seem to figure out how to run them.

https://github.com/dotnet/maui/wiki/UITests#running-from-visual-studio-code-requires-c-dev-kit-with-net-maui-extension-installed

I simply run Controls.TestCases.HostApp in my Visual Studio, type the issue number in the application that pops up, and then the test is run.

Thank, I was able to somewhat figure it out.

@jfversluis, I have made a change but it feels... hacky... so if it's not appropriate, I'll take some time to think of a different solution.

@asi-evin
Copy link
Contributor Author

@jfversluis I have have used the more conventional way of ensuring the value is "coerced" to itself if set to null. Can the test be run again?

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@asi-evin
Copy link
Contributor Author

@jfversluis Forgive my ignorance here, but it looks like the failures are all simulators that failed to start??? Is that correct??? Or am I missing something and there's something I need to change?

@jfversluis jfversluis changed the base branch from main to inflight/current September 17, 2025 08:22
@jfversluis jfversluis merged commit 7e628a3 into dotnet:inflight/current Sep 17, 2025
1 check passed
@jfversluis
Copy link
Member

Thank you for your contribution!

@jfversluis jfversluis added this to the .NET 9 SR12 milestone Sep 17, 2025
PureWeen pushed a commit that referenced this pull request Sep 18, 2025
* Added UI test for null selectin bug

* Handle when group update changes to no values

* Added unit test

* new file to file scoped namespace

* Ignore child added if layout is null

* Piggy backed off of existing UI sample

* removing unused using

* reverting whitespace

* removing unused using

* Have RadioButton default to itself for uniqueness

* Added comment justifying madness

* less hacky way

* Less hacky and added unit test

---------

Co-authored-by: Evin Ballantyne <EBallantyne@acceleratedsystems.com>
PureWeen pushed a commit that referenced this pull request Sep 18, 2025
* Added UI test for null selectin bug

* Handle when group update changes to no values

* Added unit test

* new file to file scoped namespace

* Ignore child added if layout is null

* Piggy backed off of existing UI sample

* removing unused using

* reverting whitespace

* removing unused using

* Have RadioButton default to itself for uniqueness

* Added comment justifying madness

* less hacky way

* Less hacky and added unit test

---------

Co-authored-by: Evin Ballantyne <EBallantyne@acceleratedsystems.com>
github-actions bot pushed a commit that referenced this pull request Sep 18, 2025
* Added UI test for null selectin bug

* Handle when group update changes to no values

* Added unit test

* new file to file scoped namespace

* Ignore child added if layout is null

* Piggy backed off of existing UI sample

* removing unused using

* reverting whitespace

* removing unused using

* Have RadioButton default to itself for uniqueness

* Added comment justifying madness

* less hacky way

* Less hacky and added unit test

---------

Co-authored-by: Evin Ballantyne <EBallantyne@acceleratedsystems.com>
github-actions bot pushed a commit that referenced this pull request Sep 23, 2025
* Added UI test for null selectin bug

* Handle when group update changes to no values

* Added unit test

* new file to file scoped namespace

* Ignore child added if layout is null

* Piggy backed off of existing UI sample

* removing unused using

* reverting whitespace

* removing unused using

* Have RadioButton default to itself for uniqueness

* Added comment justifying madness

* less hacky way

* Less hacky and added unit test

---------

Co-authored-by: Evin Ballantyne <EBallantyne@acceleratedsystems.com>
github-actions bot pushed a commit that referenced this pull request Sep 23, 2025
* Added UI test for null selectin bug

* Handle when group update changes to no values

* Added unit test

* new file to file scoped namespace

* Ignore child added if layout is null

* Piggy backed off of existing UI sample

* removing unused using

* reverting whitespace

* removing unused using

* Have RadioButton default to itself for uniqueness

* Added comment justifying madness

* less hacky way

* Less hacky and added unit test

---------

Co-authored-by: Evin Ballantyne <EBallantyne@acceleratedsystems.com>
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RadioButtonGroup.SelectedValue = null doesn't reset RadioButton IsChecked state

3 participants