dotnet / dotnet/maui

Image control crashes on Android when image width exceeds height

Open
#32,869 2 comments 0 reactions 0 assignees View on GitHub
area-controls-image area-image i/regression partner/syncfusion platform/android regressed-in-10-rc2 s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

When using an image that is a lot wider than the height (the example has a dimension of 1600x130, but it also fails on smaller images), the ImageControl throws an exception (Java.Lang.RuntimeException: Canvas: trying to draw too large(322641920bytes) bitmap.) on Android, causing the app to crash.

[SfImageEditorBug (2).zip](https://github.com/user-attachments/files/23771742/SfImageEditorBug.2.zip)

### Steps to Reproduce

1. Run the attached sample on Android
2. The logic for loading the image can be found within the ViewModels/MainViewModel.cs file.

### Link to public reproduction project repository

_No response_

### Version with bug

9.0.111 SR11.1

### Is this a regression from previous behavior?

Not sure, did not test other versions

### Last version that worked well

Unknown/Other

### Affected platforms

Android

### Affected platform versions

_No response_

### Did you find any workaround?

_No response_

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Research direction

Run the attached sample on Android and inspect the image-loading logic in ViewModels/MainViewModel.cs, using the reported Canvas bitmap-size exception as the starting point. Done means the wide image no longer crashes the ImageControl on Android and the reproduction can complete successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.