Bug 22766 - After update to 1.2.3 Prerelease LV.ClearValue don't work anymore
Summary: After update to 1.2.3 Prerelease LV.ClearValue don't work anymore
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-09 03:48 UTC by Fredy Wenger
Modified: 2015-05-28 07:39 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Fredy Wenger 2014-09-09 03:48:35 UTC
1.2.3 Prerelease 1

I have updatet to the Pre-release.
After the update, nothing has worked anymore…
All platforms (iOS, Andorid and WP) had (hard) crashes.
After hours of investigation, I have found the reason that causes the (new) crash:
I query a webservice and show the result in a ListView.
If the user then select an entry of the LV, I load a detailpage with the detail-data from the event lv.itemselected().
As the user is not able to select the same entry twice (without to select another entry between), I have added a workaround to solve that problem, by reset the selected value with lvErgebnisAnzeige.ClearValue ListView.SelectedItemProperty) (as last statement in lv.itemselected()
It seems, as this don’t work anymore and causes the crash on all platforms!
I also have tried, to reset the selected value in the event On Appearing()
Code sniped:

protected override void OnAppearing()
{
  base.OnAppearing();
  if (lvErgebnisAnzeige != null)
  {
    lvErgebnisAnzeige.ClearValue(ListView.SelectedItemProperty);
  }
}

I have implemented the workaround just last Friday according. 
Now, I can’t use the workaround anymore (I had to deactivate it)…:-(
Can you please confirm the new bug and that it will be solved with the next release (so that I don't have to waste my time for searching another workaround)?
Thanks
Comment 1 Prashant manu 2014-09-12 02:26:08 UTC
Could you please provide us the test steps you followed. If possible please
attach a small complete project that demonstrates this behavior.

Also can you please add the logs from the following places?:
On XS IDE Log  Location: XS>Help> Open Log Directory> IDE.log file (with latest
timestamp)
Comment 2 Fredy Wenger 2014-09-12 05:13:32 UTC
Hi Prashant

First:
- For me it is an general bug in Xamarin.Forms that an entry in an ListView cannot be selected twice (without that another item has been selected between)!
=> This should be fixed generally!
=> Therefore every developer has to implement an (annoying!) workaround to fix that to every ListView
==> I don't want to implement such workarounds, but I have to, as the app otherwise is not usable

Second:
I think, with XS - you mean "Xamarin Studio"?
=> I don't work with Xamarin Studio, I work with Visual Studio
=> So.. if you need something more, let me know what exactly

I have investigated the problem more in deep...
On my page, I have two ListViews 
For both, I (unfortunately have to!) reset the selected.Item in the  .ItemSelected-Event
In the attachment I send you the .cs-file:
- On Line 191 the Sort-ListView is reseted:
  => That works 

- On Line 326 the Main-ListView is reseted from an ASYNC .ItemSelected-Event:
  => This has worked before update  
  => This now causes a hard crash on all platforms

Debug-Info from Android:
09-12 10:45:59.936 E/mono    (31053): 
09-12 10:45:59.936 E/mono    (31053): Unhandled Exception:
09-12 10:45:59.936 E/mono    (31053): System.NullReferenceException: Object reference not set to an instance of an object
09-12 10:45:59.936 E/mono    (31053):   at MatrixGuide.EmpfehlungenPage+<>c__DisplayClass10+ctor>b__d>d__1d.MoveNext () [0x00074] in m:\SW\VS_2013\Xamarin\MatrixGuide\MatrixGuide\MG_Empfehlungen.cs:268 
09-12 10:45:59.936 E/mono-rt (31053): [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
09-12 10:45:59.936 E/mono-rt (31053):   at MatrixGuide.EmpfehlungenPage+<>c__DisplayClass10+ctor>b__d>d__1d.MoveNext () [0x00074] in m:\SW\VS_2013\Xamarin\MatrixGuide\MatrixGuide\MG_Empfehlungen.cs:268 
In mgmain JNI_OnLoad

My conclusion for now:
- It seems, that the reset from ASYNC-Event handler causes the crash in the update (while this has worked before without problems)
- If the general problem (select the same item twice) will be fixed, such workarounds will be obsolete -> REAL solution

Please let me know, if you need further information's.
As is query data from our webservice, I am not able to give you a "minimum example". But I can give you the whole project (if you handle it confidential).
I should be possible, that you can query the data from our webservice.

Fredy






 




- For me it u
Comment 4 Fredy Wenger 2015-05-28 07:39:40 UTC
As I don't use clearvalue since a while (what does not mean, that bug is fixed)and no other user has posted here, I set this bug to resolved myself to help Xamarin by the clean-out of Bugzilla.