NullReferenceException when leaving a page after selecting a suggestion
See original GitHub issueHello
I have the following exception on Android using V0.5.0
01-19 15:57:02.988 I/MonoDroid(25422): System.NullReferenceException: Object reference not set to an instance of an object.
01-19 15:57:02.988 I/MonoDroid(25422): at dotMorten.Xamarin.Forms.AutoSuggestBoxRenderer.<UpdateItemsSource>b__14_0 (System.Object o) [0x00000] in E:\GitHub\dotMorten\XamarinFormsControls\AutoSuggestBox\dotMorten.Xamarin.Forms.AutoSuggestBox\AutoSuggestBoxRenderer.cs:233
01-19 15:57:02.988 I/MonoDroid(25422): at dotMorten.Xamarin.Forms.NativeAutoSuggestBox+SuggestCompleteAdapter+<>c__DisplayClass4_0.<UpdateList>b__0 (System.Object s) [0x00000] in E:\GitHub\dotMorten\XamarinFormsControls\AutoSuggestBox\dotMorten.Xamarin.Forms.AutoSuggestBox\NativeAutoSuggestBox.Android.cs:147
01-19 15:57:02.988 I/MonoDroid(25422): at System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].ToArray () [0x00034] in <715c2ff6913942e6aa8535593b3ef35a>:0
01-19 15:57:02.988 I/MonoDroid(25422): at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <715c2ff6913942e6aa8535593b3ef35a>:0
01-19 15:57:02.988 I/MonoDroid(25422): at dotMorten.Xamarin.Forms.NativeAutoSuggestBox+SuggestCompleteAdapter+SuggestFilter.PerformFiltering (Java.Lang.ICharSequence constraint) [0x0001c] in E:\GitHub\dotMorten\XamarinFormsControls\AutoSuggestBox\dotMorten.Xamarin.Forms.AutoSuggestBox\NativeAutoSuggestBox.Android.cs:191
01-19 15:57:02.988 I/MonoDroid(25422): at Android.Widget.Filter.n_PerformFiltering_Ljava_lang_CharSequence_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_constraint) [0x00011] in <6f8818d6ffa14f4bad6fb5f5d0f0e665>:0
01-19 15:57:02.988 I/MonoDroid(25422): at (wrapper dynamic-method) System.Object.61(intptr,intptr,intptr)
Steps to Reproduce
- Go on a page with the AutoSuggestBox
- Start typing and select a suggested element (this is important, if you just type something without using the suggestion there is no error)
- Go on the previous page (or I think, do whatever that would makes the page where the AutoSuggestBox was to be unreferenced)
And thanks for the good work 😃
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
c# - What is a NullReferenceException, and how do I fix it?
If you want to find out where the reference is or isn't set, right-click its name and select "Find All References". You can...
Read more >Object reference not set to an instance of an object | Page 2
A null reference means that it is trying to access something that doesn't exist. You either forgot to drag something in the editor,...
Read more >What is a Null Reference Exception?
A NullReferenceException happens when you try to access a reference variable that isn't referencing any object. If a reference variable isn't referencing an ......
Read more >Object Reference Not Set to an Instance of an Object
This exception is thrown when you try to access a member—for instance, a method or a property—on a variable that currently holds a...
Read more >NullReferenceException on Tracking.Current When ...
When trying to fetch the content of a page to populate the Quick View, a 500 error is thrown with a NullReferenceException on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Created a test where I reproduce. https://github.com/Sim-github/AutoSuggestTest
It is a bit more convoluted than I expected, maybe what I’m doing is not the supposed way to manage carousel navigation… What I do is that I have a CarouselPage where I add my pages, and on some events I remove pages. Here in the example I created, click on the first two buttons (each add a new page in the carousel and navigate to it), on the third page select the word “Test” from the AutoSuggestBox. Then slide back to the first page and click again on the button. What this button does is remove the all next pages in the carousel and add the second page. Somehow doing this raise the error.
(But do this again without selecting “Test” and entering something else works fine… If you manage to figure out what is going on I’m curious…)
Fixed in v0.6.0