Feedback
Canvas Paint can report zero Graphics dimensions before layout
- Status
- Fixed
- Fixed in
- v26.6.5
- Source discussion
- https://forum.objo.dev/d/397-graphics-bug-paint-event
- Last updated
- 2026-06-21
Upvotes
0 upvotes
Uses your Objo forum account.
Public summary
Canvas Paint(g As Graphics) can receive a Graphics object whose Width and Height are both 0 when a Canvas is refreshed before Avalonia has completed its first layout pass. This can crash user code that divides the drawing surface into zones based on g.Width or g.Height. A default or designed Canvas should report its logical drawing size during Paint instead of transient pre-layout bounds.