Closed d00lar closed 5 months ago
Hello,
Could this "help" ?
To summarize, it's mainly because the Task is not (may not be) awaited. Which is potentially understandable if the original method was not a task : the calls to it were not "awaited".
So I would not qualify this as a bug but rather as a bad programming practice (no offence to you, of course).
Regards, Christophe
Yes i known all that but best practise is best practise and life is life / sometimes someone can forget something but still in default .net template there is some 'bar' at the bottom of page with reload btn as You probably known so same thing im expecting in mudblazor template? in .net6 template of mudblazor WebAssembly it was but in .net 8 template for 'server side' project there is not - this DIV is missing with this as i wrote
this is as expected - do You think it should not be there anymore? regards
To be honest, as I feel it's a "bad programming practice", I would not even try to solve this. It would add mess where there's already enough, I think.
Don't get me wrong, though, I understand your need to handle such exception in a task. But, as many sources seem to agree, the correct way to handle it properly is to await the call. Period. I'm not skilled enough to go against that, hence my advice to (try to) stay with good practice. Again, no offence but pure common sense or pragmatism,
Regards, Christophe
so You guys think that default blazor option for handling unhandled exceptions - 'Down bar showing that some error occured and You can try reload' is not needed anymore? but it was needes sometimes ago..? in mudblazor older / webassembly template? from witch version this concept is abbanden?
I think you guys are discussing two different things. @MBNSoftware is addressing how to address the specific exception scenario you gave as an example. While @d00lar is simply saying that the basic unhandled exception catch all logic is missing from the template. The issue raised has nothing to do with awaiting a task or not but what happens when an unhandled exception occurs.
The issue was also brought up on the template repo https://github.com/MudBlazor/Templates/issues/451
exacly - it is just example nothing more. also it just 'freaze app' when this div is missing so if some unaware developer will hit this kind of error - he can wait even hour or two waiting for task to compleat seeing no error or no sign of something bad happened.
Hi everyone, as part of upgrading templates for the upcoming MudBlazor 7.0.0 release, I rebuilt templates from scratch and the error <div>
is there. You can find the change in this PR: https://github.com/MudBlazor/Templates/pull/465
Transferred the issue to MudBlazor/Templates repo
Bug type
Component, Other
Component name
MainLayout
What happened?
in default MudBlazor serwerside template in routes.razor / old index.html
You guys are missing
<div id="blazor-error-ui"> <span style="color:black">An unhandled error has occurred.</span> <a href="" class="reload">Reload</a> <a class="dismiss">🗙</a> </div>
without this when there is an unhandled expeption
for example if in famus 'counter' component page we change from
to
then onclick there is no exception throwed in VS and app just freeze.
BE AWARE IN TRY MUDBLAZOR LINK everything is ok in default New Project / MudBlazor template NO.
Expected behavior
in defualt template error handling 'down bar' should be also implemented
Reproduction link
https://try.mudblazor.com/snippet/mEGIaTGkGgKtdJXD https://stackoverflow.com/questions/78493661/blazor-serverside-why-is-exception-not-thrown-when-in-task-how-to-avoid-this
Reproduction steps
Relevant log output
No response
Version (bug)
6.19
Version (working)
No response
What browsers are you seeing the problem on?
Chrome
On which operating systems are you experiencing the issue?
Windows
Pull Request
Code of Conduct