fix: add diagnostic warning when LoadingView Source is never set#1564
fix: add diagnostic warning when LoadingView Source is never set#1564
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a diagnostic warning to the LoadingView control that helps developers identify when the Source property is never set, which would cause the control to remain in the "Loading" visual state indefinitely. The diagnostic emits a Debug.WriteLine() message after 5 seconds if the Source remains null, providing actionable guidance without changing any functional behavior.
Changes:
- Adds
WarnIfSourceNeverSetAsync()method that schedules a deferred diagnostic warning 5 seconds after template application if Source is still null - Modifies
OnApplyTemplate()to trigger the diagnostic check - Adds required
using System.Threading.Tasks;import for async support
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
|
|
|
Congrats on your first pull-request! We ❤ the people who are involved in this project, and we’d love to pay it forward by sending you some swag. If you have any feedback (or ideas how to improve Uno as a open-source project) please open a feedback issue. |

PR Type
What kind of change does this PR introduce?
What is the current behavior?
When
LoadingView.Sourceis never set (staysnull), the control remains in theLoadingvisual state indefinitely becauseSource?.IsExecuting ?? trueevaluates totrue. There is no diagnostic output to help developers identify why the view is stuck, makingblack screen issues very difficult to troubleshoot.
What is the new behavior?
LoadingView.OnApplyTemplate()now schedules a deferred check: ifSourceis stillnullafter 5 seconds, aDebug.WriteLinewarning is emitted indicating the view will remain inLoadingstate indefinitely. The warning is a no-op in Release builds and does notchange any control flow or visual behavior.
New runtime tests validate
LoadingViewstate transitions for null Source, Source becoming not-executing, and Source set after template application.PR Checklist
Other information
Files changed:
LoadingView.cs— DeferredDebug.WriteLinediagnostic when Source stays null after template applyLoadingViewTests.cs— New runtime tests for LoadingView state transitions