Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Picker.Focus() throws exception in 3.6 #5657

Closed
samhouts opened this issue Mar 21, 2019 · 11 comments
Closed

Picker.Focus() throws exception in 3.6 #5657

samhouts opened this issue Mar 21, 2019 · 11 comments
Assignees
Labels
e/2 🕑 2 partner Issue submitted by partner or related open source project t/bug 🐛
Projects
Milestone

Comments

@samhouts
Copy link
Member

Hi @samhouts

At Xamarin forms version 3.6 last stable also, Picker.Focus() calls throws exception , I have attached the exception details, Also Issue replicated sample, follow the replication procedure

Replication Procedure:

  1. Run the attached sample and Enable the Exception settings (C++ Extensions, Common Language Runtime Exceptions)
  2. Click the Button named as LoadLabel to load the label View
  3. Click the Button named as LoadPicker to load the Xamarin forms Picker View
  4. Click the Button named as FocusPicker to get the focus for Picker
  5. Now select any item from the displayed list
  6. Click the Button named as UnFocusPicker to get the Unfocus for Picker
  7. Again Click the Button named as LoadLabel to load the label View
  8. Click the Button named as LoadPicker to load the Xamarin forms Picker View
  9. Click the Button named as FocusPicker to get the focus for Picker
  10. Now object disposed exception occurred at picker.Focus() calls

Exception screenshot:

image

Sample:
http://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGridNet-1266236982

So Focus System.ObjectDisposedException: Cannot access a disposed object issue does not get fixed in xamarin forms 3.6 last stable version and last pre release version 4.6 for Xamarin.Forms.Picker View and Xamarin.Forms.DatePicker view, Attached sample is related to Picker.Focus() calls.

Please look in to this issue and provide the fix for upcoming releases.

Originally posted by @DeepikaBalaSubramaniyan in #5202 (comment)

@pauldipietro pauldipietro added this to New in Triage Mar 21, 2019
@samhouts samhouts added t/bug 🐛 partner Issue submitted by partner or related open source project labels Mar 21, 2019
@samhouts samhouts added this to the 3.6.0 milestone Mar 21, 2019
@PureWeen PureWeen self-assigned this Mar 21, 2019
@samhouts samhouts added this to To do in v3.6.0 Mar 21, 2019
@samhouts samhouts added the e/2 🕑 2 label Mar 22, 2019
@samhouts samhouts moved this from New to Ready For Work in Triage Mar 22, 2019
@jalbertSyncroTech
Copy link

@samhouts @DeepikaBalaSubramaniyan Any known work-arounds for this until the next release? We just updated to X.F 3.6.0-sr1 but this control is on the home page of one of our consumer apps.

@jalbertSyncroTech
Copy link

Have some more information and a work-around:

To work-around the issue I made a custom Picker renderer which overrides Dispose() and OnFocusChangeRequested(). The latter checks whether the renderer has been disposed before calling the base class.

As to the cause, it looks like FocusChangeRequested event of the underlying VisualElement is not getting properly removed from disposed Pickers. In my work-around renderer the OnFocusChangeRequested() is getting called multiple times, 3 in my case. The first two times the Renderer has already been disposed, and for the last one it hasn't.

@PureWeen
Copy link
Contributor

duplicate of #5376
fixed by #5670

Triage automation moved this from Ready For Work to Closed Mar 26, 2019
@DeepikaBalaSubramaniyan

Hi @PureWeen

Still at last stable Xamarin Forms version 3.6.0.264807 and Last pre release version 4.0.0.250467-pre7 Picker.Focus() calls throws object disposed exception, But bug report was closed as fixed. Still in this simple sample able to reproduce the issue with Xamarin Forms version 3.6.0.264807 http://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGridNet-1266236982.
Kindly check this issue by installing last xamarin forms version too.

@benjaminsommerfeld
Copy link

benjaminsommerfeld commented Mar 28, 2019

@PureWeen Same here, in latest 3.6 as well as latest 4.0 pre we also get this bug when calling Picker.Focus(). Desperately waiting for a final fix, cause this is crashing one of our customer apps in App Store.

@jalbertSyncroTech Can you please post your custom Picker renderer which overrides Dispose() and OnFocusChangeRequested() ?

@PureWeen
Copy link
Contributor

#5670 hasn't been released yet

I tested your sample with the next SR coming out and it doesn't crash anymore

@benjaminsommerfeld
Copy link

@PureWeen Thanks for your reply, can you give us an approximate release date for this fix? Will it be included in the upcoming 3.6.0 and 4.0-pre8 nuget-packages?

https://www.nuget.org/packages/Xamarin.Forms

Our customers are desperately waiting for the app-update with this fix, that's why I'm asking.

@PureWeen
Copy link
Contributor

Can't give an exact date but the release is in the cooker so as long as it passes through the QA cycles then it should be out soon

@benjaminsommerfeld
Copy link

benjaminsommerfeld commented Apr 4, 2019

@PureWeen Was this part of today's build 3.6.0.293080? We now have the following behaviour: On the first Picker.Focus() call the Picker is not actually focused, only from the 2nd call on it works / displays the Picker correctly.

@PureWeen
Copy link
Contributor

PureWeen commented Apr 4, 2019

@benjaminsommerfeld if you can create a new issue and a reproduction that would be really helpful.
I tested your scenario with the project attached to this issue and for me it's working on the first call to focus.

@samhouts samhouts moved this from To do to Closed in v3.6.0 Apr 22, 2019
@samhouts samhouts removed this from Closed in Triage Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
e/2 🕑 2 partner Issue submitted by partner or related open source project t/bug 🐛
Projects
No open projects
v3.6.0
  
Closed
Development

No branches or pull requests

5 participants