-
Notifications
You must be signed in to change notification settings - Fork 1.9k
NSInternalInconsistencyException Reason: UIGraphicsBeginImageContext() failed to allocate CGBitampContext #15827
Comments
This looks like a behavioral difference in iOS, which triggers an incorrect/unexpected behavior in Xamarin.Forms. However, we'll need a test project we can use to reproduce this in order to figure out what's going on. |
Its difficult, because i don't know what went wrong and what piece of our app triggers the exception. I found devs talking about the same exception in this issue: xamarin/xamarin-macios#18964 (comment) |
That doesn't look like the same error:
you're getting:
|
Yes. You are right. |
@rolfbjarne Do you still need a sample to reproduce this? |
In fact this looks like an issue in Xamarin.Forms, so I'll move it there. Note that Xamarin.Forms doesn't get many updates anymore, so this is unlikely to be fixed - my suggestion would be to port the app to .NET / MAUI. It may also be possible to modify your project to not run into this scenario, but that's just a wild guess from my side. |
@rolfbjarne Everytime a ListView or CollectionView controls from Xamarin Forms gets used it blows up with the same exception mentioned above ( and no way around it) I tried every possible way with renderers trying to override all I can by myself but nothing worked. I wish I could migrate to MAUI but last time I tried there were a lot of issues ( like Xamarin on the starts) but I had to switch back to XCode 14.3 |
Hi, Just for testing i replaced the BoxView with a Frame. As a result no exception anymore. My app contains scrollviews and listviews. But the lists still working. No exceptions. |
I have boxview in mine as well as the separator between items in the collectionView and never occurred to me removing those. When I get a chance I will try that ( I have XCode downgraded to 14.3 version so I will have to update it and try ) |
I have not tested it without a listview/collectionview/scrollview. @jfversluis There are plans to fix fix the issue? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
The workaround mentioned in #15828 (comment) worked for us. I just needed to adjust it a little bit because we have mainly issues with the |
This comment was marked as off-topic.
This comment was marked as off-topic.
@datadruid @AlainHsu @JohnHDev a workaround is available in the linked PR, this should not be blocking you right now. Let's try and keep this issue focussed on the problem at hand and work towards a solution. |
Got the same error these days, and in my case that was related to setting the linear gradient as background for button. |
It would still be very helpful to have a reproduction here that shows where this bug hits you to make sure I catch all the places. If you have a minimal sample that shows this behavior, please add it. |
@jfversluis I pulled Xamarin.Forms 5.0.0.8551 from the PR Nuget feed and it fixed my problem - great work! I just found this thread tonight looking into this issue, and great timing as I see the PR happened today. My Xamarin.Forms iOS app which worked fine in iOS 16 and earlier was crashing on iOS 17 devices. |
to be clear though, its crashing on iOS 17 devices when its built with Xcode 15, right? If built with Xcode 14 you don't see the crash? |
In my case, my app seemed to crash on ios17 regardless of build on Xcode 14 or 15. I had several testers move to iOS 17 after it was released and it was bombing on launch even on months old builds. |
@JohnHDev are you able to test your scenario? |
Ive asked one of my developers to try it, I hope to have feedback for you today. |
@rolfbjarne, @jfversluis, @AlainHsu, @JohnHDev I can confirm build 8551 fixes my Xamarin Forms crashing issue for iOS17 simulator with Xcode 15 running Sonoma. |
@datadruid Thanks for informing! May I know how you installed build 8551? I'd like to verify that too with Rider IDE. |
@AlainHsu instructions are here: https://github.com/xamarin/Xamarin.Forms/wiki/Preview-Packages#pull-requests- But you'll have to figure out how to add a custom NuGet feed to Rider 😄 |
@jfversluis as Devin mentioned its looking good from our perspective. When do you think we'll get the official nuget packages? I can schedule in the upgrade. |
@AlainHsu In Rider, Select NuGet Packages, then select the sources tab and add the PR feed (https://pkgs.dev.azure.com/xamarin/public/_packaging/Xamarin.Forms-PullRequests/nuget/v3/index.json) to your local NuGet.config file, see image below: |
Many thanks to @jfversluis I was facing same problem, then found this thread.
Thanks again @jfversluis |
Hi,
we just updated VS for Mac (17.6.5) today and now the xf app crashes. It looks like an Xcode 15 problem, because with Xcode 14 the app runs successfully.
Here is the error message:
Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 0}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.
And the native stack trace:
Native stack trace:
Stack trace
The text was updated successfully, but these errors were encountered: