-
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
System.ObjectDisposedException: 'Cannot access a closed Stream on .net 8 maui android #19230
Comments
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process. |
Upgraded the github project to .net 8 |
Windows machine also crashes on 10 pages or more in the sample project. |
Verified this on Visual Studio Enterprise 17.9.0 Preview 2(8.0.3). Repro on Android 14.0-API34 and Windows 11 with below Project: |
We are having the same issue. After I load the image from memory stream and open a new page and navigate to back, I receive System.ObjectDisposedException on Android. This issue is preventing us to go live. When will we have a fix for this? |
Same issue here, why is this added to the backlog? is there at least some sort of workaround? |
I work around it by clearing the android imagecache:
|
@Eves101 thanks for the snippet, how often do you run this? do you use a timer or something? |
I call it when i cache or delete a file, soo fairly often... :( |
Hi @Eves101 |
Not exactly sure either, I do not cache any images, mine usually loads from from a local SQLITE db, or just in memory, like a user avatar. |
@naaeef
|
I don't get how this issue hasn't been fixed for 4 months. Saving the image may sound as workaround but it is basically a whole different approach people use to avoid this issue. |
@jonathanpeppers thoughts? |
This feels like "MAUI doesn't handle cancellation", right? Looking at the code: maui/src/Core/src/ImageSources/StreamImageSourceService/StreamImageSourceService.Android.cs Lines 28 to 32 in 68f6e4b
If you navigated away from the page, I don't see what would cancel this gracefully. Can someone comment what method in the sample is the problematic one? Which one of these?
|
👀 seems to happen when scrolling back up on The offending code seems to be: MemoryStream copyStream = new();
await memoryStream.CopyToAsync(copyStream).ConfigureAwait(true);
copyStream.Position = 0;
viewModels.ImageSource = ImageSource.FromStream(() => copyStream); |
Also seeing this issue in our production android application. The rate is low but impact is high as the entire Android app crashes as a result of this issue. We do not see this issue on iOS, only on Android. |
Also facing the same issue. CV with images |
We started having this issue after upgrading our app to .net 8 just before giving it to testers. It was working fine with .net 7. Our job was converting an existing production xamarin app to maui. I think it was like 10-11 months ago. This issue was the biggest reason the whole project was cancelled and the maui app didn't go live. I am not exaggerating. It was decided it would take too much effort to keep maintaining maui apps. |
This is still a big problem, it might as well be on par with #25224 which we also suffer from, for this issue though you cannot scroll down more then 10 items in a |
App also crashes on simple page navigation. What is the update on this ticket??? This is blocking our ability to release a stable production version. |
Description
When images are loaded from a memorystream on to a page, when going back via the backbutton on an android device a fatal error occurs. But not always, but often.
Please try the project in the repository, It is based on @jfversluis MauiBase64ImageSample on git.
Steps to Reproduce
Link to public reproduction project repository
MauiBase64ImageStreamTest
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows
Affected platform versions
No response
Did you find any workaround?
Cache the files, see project inthe repository
Relevant log output
The text was updated successfully, but these errors were encountered: