Skip to content

Add new analyzer to detect invalid Frame.Navigate calls#261

Merged
dotMorten merged 2 commits intomainfrom
page_navigate_analyzer
Apr 14, 2026
Merged

Add new analyzer to detect invalid Frame.Navigate calls#261
dotMorten merged 2 commits intomainfrom
page_navigate_analyzer

Conversation

@dotMorten
Copy link
Copy Markdown
Owner

Related Issue: #260

Closes #

PR Type

  • Bug fix
  • Feature / Enhancement
  • Refactor / Internal
  • Documentation

Summary

Validation

  • Tests added/updated where practical
  • Local build/tests/smoke checks run
  • Docs updated (if needed)

Notes

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new WinUIEx Roslyn analyzer that flags Frame.Navigate(typeof(...)) calls where the provided type does not derive from Microsoft.UI.Xaml.Controls.Page, preventing a known runtime crash scenario (Issue #260).

Changes:

  • Introduces analyzer rule WinUIEx1003 to validate Frame.Navigate(Type) target types at compile time.
  • Adds rule documentation + localized resources and ships the rule in the analyzer release manifest.
  • Adds analyzer unit tests, bumps package version, and updates .gitignore.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/WinUIEx/WinUIEx.csproj Updates package release notes to mention the new analyzer.
src/WinUIEx.Analyzers/WinUIEx.Analyzers/WinUIExFrameNavigateAnalyzer.cs Implements WinUIEx1003 diagnostic for invalid Frame.Navigate(Type) target types.
src/WinUIEx.Analyzers/WinUIEx.Analyzers/Resources.resx Adds localized strings for WinUIEx1003 title/message/description.
src/WinUIEx.Analyzers/WinUIEx.Analyzers/Resources.Designer.cs Regenerates resource accessors for the new WinUIEx1003 strings.
src/WinUIEx.Analyzers/WinUIEx.Analyzers/AnalyzerReleases.Shipped.md Records WinUIEx1003 as a shipped analyzer rule.
src/WinUIEx.Analyzers/WinUIEx.Analyzers.Test/WinUIExFrameNavigateAnalyzerTests.cs Adds unit tests covering valid/invalid Frame.Navigate(typeof(...)) usage.
src/Directory.Build.targets Bumps package version to 2.9.1.
docs/rules/WinUIEx1003.md Adds documentation page for the new analyzer rule.
.gitignore Ignores local .dotnet directory.
Files not reviewed (1)
  • src/WinUIEx.Analyzers/WinUIEx.Analyzers/Resources.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/WinUIEx/WinUIEx.csproj Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dotMorten dotMorten merged commit 05b7020 into main Apr 14, 2026
1 check passed
@dotMorten dotMorten deleted the page_navigate_analyzer branch April 14, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants