-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[regression/8.0.0-preview.5.8529] Crash on scrolling collection view #18834
Comments
Same here :/ I had to wait with releasing of my app due to huge issues in .net7 |
Verified this on Visual Studio Enterprise 17.9.0 Preview 1(8.0.3). Repro on Android 14.0-API34 and Windows 11, not repro on iOS 17.0 and MacCatalyst with below Project: |
@samhouts: what is the status on this issue? We experiencing the same crashes and this is preventing us releasing an urgent update to our customers! Update after looking at similar issues and try/error: Hope this helps solving this issue again! BR Stefan |
Same here, we get the same crashes in our public app right now with couple of devices. We see the same error as above: |
@mauiteam Is there any update about this? |
Same issue with .NET 8. |
When I replace the default public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
})
.ConfigureImageSources(services =>
{
#if ANDROID
services.RemoveAll<IImageSourceService<IStreamImageSource>>();
services.RemoveAll<IImageSourceService<StreamImageSource>>();
services.AddService<IStreamImageSource>(_ => new CustomStreamImageSourceService());
services.AddService<StreamImageSource>(_ => new CustomStreamImageSourceService());
#endif
});
#if DEBUG
builder.Logging.AddDebug();
#endif
return builder.Build();
}
#if ANDROID
public class CustomStreamImageSourceService : StreamImageSourceService
{
public override async Task<IImageSourceServiceResult?> LoadDrawableAsync(IImageSource imageSource, ImageView imageView, CancellationToken cancellationToken = default)
{
var result = await base.GetDrawableAsync(imageSource, imageView.Context!, cancellationToken);
// if (result?.Value is BitmapDrawable drawable && drawable.Bitmap?.IsRecycled == true)
// {
// drawable.Bitmap.IsRecycled always false.
// }
imageView.SetImageDrawable(result?.Value);
return result;
}
}
#endif
} It might be |
I'm getting this error when I have an Image on my CarouselView . This is a show stopper for me. I'm using: Net 8 MAUI - Latest VS2022 == Version 17.9.5
|
Chiming in here with my 2c worth of evidence. I'm getting same issue with dotnet 8.0 (8.0.3) and VS 2022 Version 17.9.5
I'm rather glad I found my way to this issue, I thought I was doing something wrong. |
Confirmed that this regressed between 8.0.0-preview.4.8333 and 8.0.0-preview.5.8529. Before pre5, the scrolling performance was atrocious, so I assume this was a memory leak resolved by properly disposing of the images. However, that leads to this crash. Not sure exactly what the culprit was, but #14933, #12011, and #14109 seem most sus. Incidentally, I changed the Frame to a Border to see if it helped and with that, I see that the background color of the cell goes from white in pre4 to black in pre5, which seems to be related to #14933 and is probably another regression/behavior change. |
I have seen this before. In Android: Setting WidthRequest=100, HeightRequest=100 is quick way to check if this applies to you. (Forgot to say that this IOS behavior does not repeat when you close and open the app (it seems caching is involved in making the problem resolve itself), only reinstall introduces it again. But on Android it is persistent.) |
Thanks for the reply!
Meaning the crashing stops? I've wondered if perhaps I can set or bind the height/width request to a calculated value so it is provided (but still fills the available width/height but stops the crashes) |
Not only the android crashing. The weird behavior on IOS also. Set specific measurements and both problems are gone. To make matter worse - on the device I develop with most of the time, this problem could not be reproduced. I hope this saves you some time. |
Any news on this? This issue is still presenting with maui 8.0.40. |
From my tests this resolve the problem |
I ran into this one again on my own app when I decided to remove the |
@samhouts I've observed that Interestingly, if |
@viktorszekeress Did you try if this workaround work for you? For me it seems to work
|
@Simoo23 I tried that and it does indeed solve the original problem - application doesn't crash now. The new problem is that RAM usage skyrockets for me to 2+GB. I have a I also noticed decreased performance with this solution. What I eventually did is that instead of converting |
@viktorszekeress I'll try to check the Ram usage too. But how do you convert byte[] to Image and bind to Image component in MVVM without using ImageSource? |
@Simoo23 Instead of using |
Does this work flawlessly on both iOS and ANdroid? Also, what if we need to bind the image from an HTTP URI link? Any ideas there? |
I haven't tested it on iOS. The question is, do we need this workaround there?
It's just a matter of converter (parameter) and how you construct the image. |
Is not possibile to increase the priority of this bug? |
Are you sure about this? I cannot say about "width", but I am using "HeightRequest" of 500 and above, without this issue manifesting. |
I'm sure. Obviously, it depends on other circumstances, like: original size of the image, aspect ratio, available area... |
Description
App just crashes with
Java.Lang.RuntimeException: 'Canvas: trying to use a recycled bitmap android.graphics.Bitmap@4b0165b'
Seems like the same issue as before. This should be solved here, but in every 8.0.* revision it seems to still be crashing (and I've tried them all).
Here is the call stack. It always seems to be the same. The very odd thing in it is the reference to net7.0/JniEnvironment.g.cs. As the version I'm runing the app is .net8 ¯_(ツ)_/¯
Steps to Reproduce
Expected behavior: images open up and older images are pushed down
Actual behavior: images open up and older images are pushed down, but after about a minute you experience a crash with Java.Lang.RuntimeException: 'Canvas: trying to use a recycled bitmap android.graphics.Bitmap@4b0165b
P.S. for anyone that might launch the app on windows and see the insane behavior of DataTemplates - I already reported it here, over a year back.
Link to public reproduction project repository
https://github.com/MissedSte4k/MAUI-Canvas-trying-to-use-a-recycled-bitmap-crash-sample
Version with bug
8.0.0-preview.5.8529
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.0-preview.4.8333
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
Nope. Tried everything referenced in issues that got solved in #12310, but to no avail.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: