Skip to content

MudRadio: Fix Stack overflow caused by recurrence.#8412

Merged
mikes-gh merged 2 commits intoMudBlazor:devfrom
isakgamnes:fix/mudradio-option-recurrency
Mar 21, 2024
Merged

MudRadio: Fix Stack overflow caused by recurrence.#8412
mikes-gh merged 2 commits intoMudBlazor:devfrom
isakgamnes:fix/mudradio-option-recurrency

Conversation

@isakgamnes
Copy link
Contributor

@isakgamnes isakgamnes commented Mar 21, 2024

This change will make MudRadio.Option return Value instead of Option. This causes recurrence and results in Stack overflow exception.

Description

Fixes: #8411

How Has This Been Tested?

UnitTests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels Mar 21, 2024
@codecov
Copy link

codecov bot commented Mar 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.88%. Comparing base (a378c2c) to head (71e20a7).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #8412   +/-   ##
=======================================
  Coverage   88.87%   88.88%           
=======================================
  Files         414      414           
  Lines       12292    12292           
  Branches     2455     2455           
=======================================
+ Hits        10925    10926    +1     
+ Misses        837      836    -1     
  Partials      530      530           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ScarletKuro ScarletKuro changed the title change getter method of MudRadio.Option to return Value MudRadio: Fix Stack overflow caused by recurrence. Mar 21, 2024
@ScarletKuro
Copy link
Member

Hi. Thanks for contribution.

UnitTests

It says unit tests, but I don't see any new unit tests and our current unit tests didn't cover this issue.
You need to write a bUnit tests that caused this issue #8411 without your applied fix, and then it should pass with your fix.
It's mandatory to include a bUnit when it comes to bug fixes.

@henon
Copy link
Contributor

henon commented Mar 21, 2024

Awesome. How did our unit tests not catch that? Clearly there is a hole in the test suite. Will you please add a simple test that goes into stack overflow without the fix? Thanks!

Edit: Haha, you beat me @ScarletKuro

@isakgamnes
Copy link
Contributor Author

isakgamnes commented Mar 21, 2024

Awesome. How did our unit tests not catch that? Clearly there is a hole in the test suite. Will you please add a simple test that goes into stack overflow without the fix? Thanks!

All UnitTests covering Option was changed to Value. There are no tests for Option anymore, and therefore it passed :)

@isakgamnes
Copy link
Contributor Author

Hi. Thanks for contribution.

UnitTests

It says unit tests, but I don't see any new unit tests and our current unit tests didn't cover this issue. You need to write a bUnit tests that caused this issue #8411 without your applied fix, and then it should pass with your fix. It's mandatory to include a bUnit when it comes to bug fixes.

I will write a test for it now

@mikes-gh
Copy link
Contributor

mikes-gh commented Mar 21, 2024

When making backwards compatibility changes, we should always keep the old tests. That was an error on the previous PR. Perhaps you can look at the previous PR and resurrect them. You may have to pragma the obsolete usage. I suspect that the PR that made the changes also did the same for the other components that were changed to Value.

@ScarletKuro
Copy link
Member

ScarletKuro commented Mar 21, 2024

All UnitTests covering Option was changed to Value. There are no tests for Option anymore, and therefore it passed :)

Oh, I see now how this regression happened. It was introduced in this PR #7892, specifically this file change https://github.com/MudBlazor/MudBlazor/pull/7892/files#diff-dc31ee09bdb8429effe29754907962c4f424a061132113699e2f83ae05943588
Since all tests indeed switched to Value it was never found.

@isakgamnes
Copy link
Contributor Author

isakgamnes commented Mar 21, 2024

Added a single test for it now. I guess that is good enough, as it is a simple fix. I tried first without the fix, and it just ran until it stopped without any good feedback on what happened. It does not pass. After the change to return Value, it passes :)

@ScarletKuro
Copy link
Member

Added a single test for it now. I guess that is good enough

I think that's good enough, imo.

@mikes-gh mikes-gh merged commit 448bad0 into MudBlazor:dev Mar 21, 2024
@ScarletKuro ScarletKuro mentioned this pull request Mar 21, 2024
2 tasks
@isakgamnes
Copy link
Contributor Author

@ScarletKuro Is it possible to create a v6.18.1 or a prerelease that includes this fix?

@henon
Copy link
Contributor

henon commented Mar 22, 2024

I will simply make a release now. It'll be on nuget shortly

biegehydra pushed a commit to biegehydra/MudBlazor that referenced this pull request Apr 26, 2024
* change getter method of MudRadio.Option to return Value

* add test that Option still works after it was set to Obsolete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option variable returns itself.

4 participants