CommunityToolkit / CommunityToolkit/Maui

[BUG] DrawingView Error : PlatformView cannot be null here when used with BindableLayout (Android and iOS)

Open
#2,320 1 comment 0 reactions 0 assignees View on GitHub
area/views bug unverified
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Did you read the "Reporting a bug" section on Contributing file?

- [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### Current Behavior

Application crashes with PlatformView cannot be null here when drawing view is used inside bindable layout. app crashes while changing the item source of the bindable layout. This happens on both Android and iOS.

Error Started after upgrading to Microsoft.Maui.Controls 8.0.60+ (latest release 8.0.92 also has same problem.)

Please find Git repo that produces same error:
https://github.com/mahesh139/MAUIBugs

This was working fine with **Microsoft.Maui.Controls 8.0.40**

### Expected Behavior

Changing bindable layout item source that contains drawing view must not crash.

### Steps To Reproduce

1. Open and run the solution.
2. Click on "Section 2" button, this will change bindable layout item source (no items in source)
3. Click on "Section 1" button, App crashes with PlatformView cannot be null here error while changing item source.

Hope this video helps with re-production steps:
https://github.com/user-attachments/assets/ec693e41-b910-4d36-9d4c-12a6f7489072

### Link to public reproduction project repository

https://github.com/mahesh139/MAUIBugs

### Environment

- .NET MAUI CommunityToolkit:9.1.0
- OS: Win 10
- .NET MAUI:8
- Microsoft.Maui.Controls 8.0.92
- Microsoft.Maui.Controls.Compatibility 8.0.92

### Anything else?

**Same repo works fine for:**
CommunityToolkit.Maui 9.0.0
Microsoft.Maui.Controls 8.0.40
Microsoft.Maui.Controls.Compatibility 8.0.40

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.