Bug Report: App crashes when drawing text on pointer pressed in GraphicsView (Windows)
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 296
Description
### Description
The application crashes with exit code 0xc000027b when drawing text using DrawText() in a GraphicsView in response to a PointerPressed event on Windows. This happens particularly when ManipulationMode is set to All and using custom font.
https://github.com/user-attachments/assets/eecd8e89-17c9-4764-b21e-9e6c15141fb4
In our app, we update the appearance of text when it's pressed (e.g., changing color, weight, or other styles). This is essential to provide immediate feedback for user interaction. This requires us to trigger a redraw during PointerPressed and render the text.
This is a valid and common use case, especially for interactive or touch-based UIs. The crash prevents us from supporting basic touch interactions involving text on Windows in .NET MAUI.
⚙️ Implementation Details
1. Implemented a custom view using View and ViewHandler.
2. Utilized GraphicsView to draw text.
3. Set ManipulationMode to All and subscribed to the PointerPressed event to trigger text redraw.
4. Used a custom font in the sample project for text rendering.
### Steps to Reproduce
1. Run the attached sample on Windows.
2. Rapidly press and move the pointer simultaneousely over the drawn text.
3. The app will crash with the following error:
Error Code: 0xc000027b
Exit Code: 3221226107
**Note: Issue occurs when using combination of ManipulationMode All, Custom Font and Text redraw.**
[MauiApp1.zip](https://github.com/user-attachments/files/20120181/MauiApp1.zip)
### Link to public reproduction project repository
_No response_
### Version with bug
9.0.60 SR6
### Is this a regression from previous behavior?
Not sure, did not test other versions
### Last version that worked well
Unknown/Other
### Affected platforms
Windows
### Affected platform versions
_No response_
### Did you find any workaround?
_No response_
### Relevant log output
```shell
```
Contributor guide
Research direction
Start by running the attached MauiApp1.zip sample on Windows and reproducing the crash while rapidly pressing and moving over the drawn text. Focus on the GraphicsView PointerPressed path with ManipulationMode set to All, a custom font, and text redraw; done means this interaction no longer exits with error 0xc000027b.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- computer-graphics, desktop, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100