Fix warnings/ messages - #15
Merged
Merged
Conversation
Updated `CreateWindow` to use simplified object instantiation. Replaced `DisplayAlert` with `DisplayAlertAsync` across files to improve asynchronous handling. Refactored null checks in `TapGestureRecognizer_OnTapped` using the null-conditional operator. Simplified class and interface definitions by removing redundant braces. Streamlined `MainApplication` constructor and removed unused imports in `TestViewModel`. These changes enhance readability, maintainability, and modernize the codebase.
There was a problem hiding this comment.
Pull Request Overview
This PR addresses compiler warnings and messages by modernizing the C# codebase with various syntax improvements and refactorings.
- Converts empty class/interface bodies to use C# file-scoped type declarations with semicolon syntax
- Updates method calls from
DisplayAlerttoDisplayAlertAsyncacross multiple page implementations - Simplifies code with null-conditional operators and primary constructors
- Removes formatting inconsistencies and unused attributes
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Scr/Handler/StateButtonHandler.cs | Converts empty class body to semicolon syntax |
| Scr/Handler/IStateButtonHandler.cs | Converts empty interface body to semicolon syntax |
| Demo/ViewModels/TestViewModel.cs | Removes unused import and attribute, fixes spacing, updates DisplayAlert call |
| Demo/Platforms/Android/MainApplication.cs | Refactors to use primary constructor syntax |
| Demo/Platforms/Android/MainActivity.cs | Converts empty class body to semicolon syntax |
| Demo/Pages/EventCommandPage.xaml.cs | Updates DisplayAlert calls and simplifies null checks with null-conditional operators |
| Demo/Pages/ButtonNotInScrollViewPage.xaml.cs | Updates DisplayAlert method calls to DisplayAlertAsync |
| Demo/Pages/AccessibilityTestPage.xaml.cs | Updates DisplayAlert method calls to DisplayAlertAsync |
| Demo/App.xaml.cs | Simplifies Window instantiation using target-typed new expression |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| async void StateButton_Clicked(object sender, EventArgs e) | ||
| { | ||
| await DisplayAlert("Clicked", string.Empty, "OK"); | ||
| await DisplayAlertAsync("Clicked", string.Empty, "OK"); |
There was a problem hiding this comment.
The method name DisplayAlertAsync does not exist in the standard .NET MAUI ContentPage API. The correct method name is DisplayAlert. This change will cause compilation errors unless a custom extension method exists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.