MudFormComponent: Fix bad test causing invalid operation exception#7579
MudFormComponent: Fix bad test causing invalid operation exception#7579henon merged 2 commits intoMudBlazor:devfrom
Conversation
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #7579 +/- ##
==========================================
- Coverage 90.58% 90.57% -0.02%
==========================================
Files 427 427
Lines 15219 15219
==========================================
- Hits 13786 13784 -2
- Misses 1433 1435 +2
☔ View full report in Codecov by Sentry. |
|
For the context, the error was discovered during this CI run: https://github.com/MudBlazor/MudBlazor/actions/runs/6361995369/job/17276757228?pr=7578 Do I understand it correctly, that this exception is not related to #7578 PR and it's was a flaky test introduced here #7564?
Usually, there shouldn't be any impact, if the call is on the correct thread the My understanding is that the the problematic line is here in the which this test is calling: and it not always doing it in the UI context? Shouldn't you modify the component parameters through SetParam -> comp.SetParam(p => p.Date, oldDate); to avoid this?
@igotinfected can you please test if the |
@ScarletKuro Seems like it, the CI for that PR has the exception in the stacktrace but didn't fail: https://github.com/MudBlazor/MudBlazor/actions/runs/6355882553/job/17264634698 The re-run you launched for my other PR passes, but the exception is still present: https://github.com/MudBlazor/MudBlazor/actions/runs/6361995369/job/17283133249
Good spot! Can't reproduce the exception if I swap out to |
Wow, I didn't notice. Totally unexpected for me that tests pass but there is exception under tests, pretty weird behavior for me which shouldn't be acceptable. The problem exist in the #7564 PR run https://github.com/MudBlazor/MudBlazor/pull/7564/checks
Yeah, lets just remove the
Don't think so, this is a job for the code review (us) to not miss this, this time it went through :) |
|
Pushed the change!
From what I can tell the reason we get a stacktrace at all is because of the default implementation of MudBlazor/src/MudBlazor/Services/MudGlobal.cs Lines 27 to 31 in bd04d94 Which is then called here: MudBlazor/src/MudBlazor/Extensions/TaskExtensions.cs Lines 28 to 32 in bd04d94 No clue if there is any way to make tests fail with that though. You would have to await the |
|
Thanks @igotinfected ! |
…udBlazor#7579) * MudFormComponent: Fix invalid operation exception * Fix test instead of component
Description
Fixes an issue causing an
InvalidOperationException.I am not sure what kind of impact this change can have on an application, never needed to wrap a
StateHasChangedcall withInvokeAsync.Stacktrace (#7578):
Previously this test would pass but threw an exception:
Now it passes without exception:
How Has This Been Tested?
Re-ran all unit tests. Had to adapt one
ColorPickertest for flakiness.Types of changes
Checklist:
dev).