RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Copilot instructions/dotnet/maui

Copilot instructions

.github/instructions/handler-patterns.instructions.md
Copilot instructions

Quality

55/100

Scores the file, not the repository.

Length

282 words

7 headings · 0 code blocks

Repository

23k

— · pushed 0 days ago

Last changed

3 days ago

First indexed 3 days ago.
dotnet/maui/.github/instructions/handler-patterns.instructions.mdRawGitHub
1---
2applyTo:
3 - "src/Core/src/Handlers/**"
4 - "src/Controls/src/Core/Handlers/**"
5---
6# Handler Mapper and Property Patterns
7 
8## Property Update Flow
9- Property updates MUST go through `Handler.UpdateValue(nameof(Property))` — never call mapper methods directly
10- Direct calls bypass user-registered `AppendToMapping`/`PrependToMapping` customizations
11- Map dependencies before dependents — if property B reads property A, A's mapper must run first
12- `CommandMapper` entries return void and use the `(handler, view, args)` signature
13 
14## Lifecycle Management
15- **ConnectHandler**: Register listeners, subscribe to events, capture native defaults BEFORE applying cross-platform properties
16- **DisconnectHandler**: Unsubscribe all events, dispose platform resources, null out references
17- Call `base.ConnectHandler`/`base.DisconnectHandler` — base class performs platform hookup/teardown (NOT mapper initialization, which happens in `SetVirtualView`)
18 
19## Null Safety in Callbacks
20- Null-check `VirtualView` before access in every mapper method and platform callback — it is null during disconnect
21- Validate `MauiContext` before use — throw `InvalidOperationException` with descriptive message if null
22- After async operations, verify the handler is still connected before applying results
23 
24## Native Defaults Preservation
25- Capture native default values (colors, fonts, styles) in `ConnectHandler` BEFORE any cross-platform property is applied
26- Clearing a cross-platform property (setting to null/default) must restore the captured native default, not a hardcoded fallback
27- On Windows, preserve WinUI XAML style-applied values; on Android, cache theme-inherited drawables; on iOS, capture UIAppearance defaults
28 
29## Mapper Extensibility
30- When extending existing mappers, ensure the base mapper chain is called — do not silently replace
31- Static mapper methods should be `public static` to enable platform-specific overrides
32- Use `nameof()` for property keys — avoid magic strings
33 
34## Fire-and-Forget Async
35- Use `.FireAndForget(handler)` for async operations in mapper methods — never use bare `async void`
36- The `FireAndForget` overload accepting a handler logs exceptions through the handler's service provider
37 

Sections

  • Handler Mapper and Property Patterns
  • Property Update Flow
  • Lifecycle Management
  • Null Safety in Callbacks
  • Native Defaults Preservation
  • Mapper Extensibility
  • Fire-and-Forget Async

What it covers

code-styledo-not

Stack — with the evidence

csharp

(1.00)

dotnet

(1.00)

swift

(0.60)

github-actions

(0.60)

Glob targeting

  • src/Core/src/Handlers/**
  • src/Controls/src/Core/Handlers/**

Format

Copilot instructions

Two layers: one always-on repo file, plus optional glob-scoped instruction files. Lives under .github/ rather than the repo root, which is the tell that it is aimed at the GitHub platform surface as much as the editor.

What the corpus says about it

Repository

Owner
dotnet
Language
—
License
—
Archived
no

All configs in this repo

Also in dotnet/maui

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
dotnet/maui.github/copilot-instructions.md · 23kCopilot instructionscsharpdotnet+2setuptestlint-formatstyle+676/1003 days ago
dotnet/maui.github/instructions/android.instructions.md · 23kCopilot instructionscsharpdotnet+2buildstyle70/1003 days ago
dotnet/maui.github/instructions/ci-copilot-pipeline-security.instructions.md · 23kCopilot instructionscsharpdotnet+2gitsecuritydeploymentdo-not+176/1003 days ago
dotnet/maui.github/instructions/collectionview-android.instructions.md · 23kCopilot instructionscsharpdotnet+2stylearchperformanceagent-behaviour52/1003 days ago
dotnet/maui.github/instructions/collectionview-handler-detection.instructions.md · 23kCopilot instructionscsharpdotnet+2stylegitdo-not73/1003 days ago
dotnet/maui.github/instructions/collectionview-ios.instructions.md · 23kCopilot instructionscsharpdotnet+2styleperformance48/1003 days ago
dotnet/maui.github/instructions/collectionview-windows.instructions.md · 23kCopilot instructionscsharpdotnet+2stylearch52/1003 days ago
dotnet/maui.github/instructions/helix-device-tests.instructions.md · 23kCopilot instructionscsharpdotnet+2setupbuildtestarch74/1003 days ago
dotnet/maui.github/instructions/integration-tests.instructions.md · 23kCopilot instructionscsharpdotnet+2setupteststyledo-not92/1003 days ago
dotnet/maui.github/instructions/layout-system.instructions.md · 23kCopilot instructionscsharpdotnet+2archapiperformancedo-not55/1003 days ago
dotnet/maui.github/instructions/performance-hotpaths.instructions.md · 23kCopilot instructionscsharpdotnet+2styleperformancedo-not55/1003 days ago
dotnet/maui.github/instructions/public-api.instructions.md · 23kCopilot instructionscsharpdotnet+2apido-not59/1003 days ago
dotnet/maui.github/instructions/safe-area-ios.instructions.md · 23kCopilot instructionscsharpdotnet+2stylegit43/1003 days ago
dotnet/maui.github/instructions/sandbox.instructions.md · 23kCopilot instructionscsharpdotnet+2buildteststyletesting-strategy+481/1003 days ago
dotnet/maui.github/instructions/templates.instructions.md · 23kCopilot instructionscsharpdotnet+2buildteststylearch+192/1003 days ago
dotnet/maui.github/instructions/threading-async.instructions.md · 23kCopilot instructionscsharpdotnet+2styleui48/1003 days ago
dotnet/maui.github/instructions/uitests.instructions.md · 23kCopilot instructionscsharpdotnet+2setupbuildteststyle+579/1003 days ago
dotnet/maui.github/instructions/xaml-unittests.instructions.md · 23kCopilot instructionscsharpdotnet+2teststyledocs70/1003 days ago
Diff against .github/copilot-instructions.md Diff against .github/instructions/android.instructions.md Diff against .github/instructions/ci-copilot-pipeline-security.instructions.md Diff against .github/instructions/collectionview-android.instructions.md Diff against .github/instructions/collectionview-handler-detection.instructions.md Diff against .github/instructions/collectionview-ios.instructions.md Diff against .github/instructions/collectionview-windows.instructions.md Diff against .github/instructions/helix-device-tests.instructions.md Diff against .github/instructions/integration-tests.instructions.md Diff against .github/instructions/layout-system.instructions.md Diff against .github/instructions/performance-hotpaths.instructions.md Diff against .github/instructions/public-api.instructions.md Diff against .github/instructions/safe-area-ios.instructions.md Diff against .github/instructions/sandbox.instructions.md Diff against .github/instructions/templates.instructions.md Diff against .github/instructions/threading-async.instructions.md Diff against .github/instructions/uitests.instructions.md Diff against .github/instructions/xaml-unittests.instructions.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
dotnet/roslyn.github/instructions/Compiler.instructions.md · 21kCopilot instructionscsharpdotnet+1buildteststylearch+399/1003 days ago
dotnet/roslyn.github/copilot-instructions.md · 21kCopilot instructionscsharpdotnet+1buildteststylearch+397/1003 days ago
ardalis/CleanArchitecture.github/copilot-instructions.md · 18kCopilot instructionscsharpdotnet+1buildteststylearch+496/1003 days ago
dotnet/maui.github/instructions/templates.instructions.md · 23kCopilot instructionscsharpdotnet+2buildteststylearch+192/1003 days ago
dotnet/maui.github/instructions/integration-tests.instructions.md · 23kCopilot instructionscsharpdotnet+2setupteststyledo-not92/1003 days ago
microsoft/WSL.github/copilot-instructions.md · 33kCopilot instructionscsharpcpp+2setupbuildtestlint-format+788/1003 days ago
we-promise/sure.github/copilot-instructions.md · 9.3kCopilot instructionsrubyrails+13setuptestlint-formatstyle+1088/1002 days ago
PowerShell/PowerShell.github/instructions/start-native-execution.instructions.md · 55kCopilot instructionscsharpdotnet+1buildstylearchgit+186/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack