-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] Crash in iOS's EntryRenderer due to "NSRangeException Reason: Cannot remove an observer ... for the key path "sublayers" from <CALayer 0x600007b11e80> because it is not registered as an observer." #14804
Comments
Thanks! Please ping me when you have reproduction steps and ideally a small project repro :) |
Attached is the top part of the callstack. Trying to include it inline renders is unreadable due to excessive word-wrapping. In my application, I'm using BindableLayout where the template for each item includes an Entry. Setting the property which is bound to the ItemsSource to something is when the crash happens. |
Thanks for the strack trace, I'd still like to have a repro if you can provide it though. From a first quick test I'm not able to reproduce it immediately. |
I'm still trying to reduce down our app to something that repro's the crash but it's proving a bit time-consuming trying to peel back several custom controls and effects that are all being used on the crashing page to pinpoint the exact cause. |
Alright, thanks! :) I have dug into the code and might have a possible fix. I will put it in a PR in a little. If I could ask you to download the NuGet that results from that and test it for me that would be amazing! |
I updated XF to 5.0.0.2196 and just experienced this issue (not sure if they are relevant). When will there be a fix? Downgrading to 5.0.0.2125 for now |
Should be released early next week. Thanks! |
@jfversluis in v5.0.0.2244 keep crashing iOS 13.5, 13.6.1 not fixed |
Correct, see #14887 please try the current nightly build |
Meanwhile, is there some sort of a workaround? |
Either downgrade or use the nightly version. I'm thinking of releasing the new version a bit earlier tbh. Running the tests now maybe I can already do the update next week. Either way it would be great to know if the current nightly version fixes the problem for you @aperel66 |
This works for me even in Release build.
|
I would love to help you out. However, the crash is very intermittent. I only see it from Microsoft crash center as we have thousands of users.
…Sent from my iPhone
Alex
On Dec 1, 2021, at 10:29 AM, Gerald Versluis ***@***.***> wrote:
Meanwhile, is there some sort of a workaround? Like is there a method in the renderer that we can put a try/catch to extinguish this exception?
Either downgrade or use the nightly version. I'm thinking of releasing the new version a bit earlier tbh. Running the tests now maybe I can already do the update next week. Either way it would be great to know if the current nightly version fixes the problem for you @aperel66
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Thank you!! Thats very helpful!!
…Sent from my iPhone
Alex
On Dec 1, 2021, at 10:34 AM, Vitaly Knyazev ***@***.***> wrote:
Meanwhile, is there some sort of a workaround? Like is there a method in the renderer that we can put a try/catch to extinguish this exception?
This works for me even in Release build.
Just try/catch still crashes in Release by some reason so simply not calling Dispose for older iOS.
protected override void Dispose(bool disposing)
{
if(VersionCheck.IsiOS14OrNewer)
base.Dispose(disposing);
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
I am also encountering this issue and the snippet @VitalyKnyazev posted above worked for me...my only question is - are there harmful side effects to not disposing this object to alleviate this issue? Not disposing resources seems like a memory leak that could cause issues. Going to try looking into EntryRenderer's source code but I thought I might as well ask it here, too. @jfversluis |
This issue seems to be "closed" as I write this on 02/24/2022. What released version of Xamarin.Forms contains this fix? |
@bitshftr This was fixed in SR8 |
^ Does that equate to Xamarin.Forms Version 5.0.0.2291 ? |
this solves the issue as the error is unhandled.
put it in the xamarin.ios render extension class. |
Description
The changes in PR #14526 added an observer to the ClearButton on an Entry to ensure correct tinting of the clear button which was released in SR6.
After updating to SR6 I'm seeing the following crash on iOS 12.5.5:
Name: NSRangeException Reason: Cannot remove an observer ... for the key path "sublayers" from <CALayer 0x600007b11e80> because it is not registered as an observer.
It happens on EntryRenderer Dispose call at this line:
ClearButton?.Layer?.RemoveObserver(this, new NSString("sublayers"));
Steps to Reproduce
Expected Behavior
Application should not crash.
Actual Behavior
Crashes with the reported error.
Basic Information
Reproduction Link
Workaround
None as yet.
The text was updated successfully, but these errors were encountered: