-
Notifications
You must be signed in to change notification settings - Fork 79
On mainpage change I got error Object reference not set to an instance of an object #97
Comments
can you please give me a working repro of this issue? |
Yes, there we go: But it's pretty simple, just create a new project, add your controls, put a newpage and run :) *Update |
@ChaseFlorell this is because in xamarin 4 Dispose is called correctly on the renderer (wonder why it didn't in previous versions though)... Control is null when getting in OnElementChanged, so the unsubscribes fail. So the onelementchanged should check if Control != null where applicable I use this customrenderer as temporary workaround (reset element before control is reset):
|
Late comment... but I ran into the same error using Xamarin.Forms 4.X on iOS. My solution was to downgrade Xamarin.Forms to version 3.5.0.129452 (which is the version this package is built on). |
Make sure to add the ExportRenderer. I'm brand spanking new to xamarin and C#, so I figured this would help those still learning. Feed control being used in page (XfxEntry) and your custom renderer (CustomXfxEntryRendererTouch).
|
I did implement the CustomXfxEntryRendererTouch but i'm still getting the same error any ideas? |
This solved my problem, thanks @JimmyBarrientos |
Using Xamarin Forms 4.3, I've tried the above but the CustomXfxEntryRendererTouch doesn't get instantiated. I've added the assembly too. Still getting the same error. Does anybody have any more ideas please? |
Someone needs to update this library to run on a newer version of XF. I wound up using an entry and listview on a separate page activated by a button to get the autocomplete functionality. |
I'm the owner of the code, unfortunately I haven't had the need to use this for quite some time, so I've let it fall into disrepair. I'd like to continue maintaining it, it's just a pile of time that I don't have. I do take PR's, however I'll still need to put some effort into deploying nuget updates. |
@JackMakhoul, @j-h-m, I had to create a new class inheriting from XfxEntry, and asociate the renderer with it:
Obviously in your page you need to use this control instead of the original one, and you have to go through the same process if you're using XfxComboBox too. |
Hi, thank for this controls.
When I change my App.mainpage to something else, the app crash and I got this error:
Object reference not set to an instance of an object
at Xfx.Controls.iOS.Renderers.XfxEntryRendererTouch.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs1[TElement] e) [0x00015] in <f2149ff8a79944c98fa707a3abffd0b5>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x0012a] in <db147fad2aa9412c845ff0ead92dfe20>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x0008c] in <db147fad2aa9412c845ff0ead92dfe20>:0 at Xamarin.Forms.Platform.iOS.ViewRenderer2[TView,TNativeView].Dispose (System.Boolean disposing) [0x0005c] in <db147fad2aa9412c845ff0ead92dfe20>:0 at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/Foundation/NSObject2.cs:147 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0003f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:69 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:37 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x00058] in <db147fad2aa9412c845ff0ead92dfe20>:0 at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/Foundation/NSObject2.cs:147 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0003f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:69 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:37 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x00058] in <db147fad2aa9412c845ff0ead92dfe20>:0 at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/Foundation/NSObject2.cs:147 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0003f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:69 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:37 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x00058] in <db147fad2aa9412c845ff0ead92dfe20>:0 at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/Foundation/NSObject2.cs:147 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0003f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:69 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:37 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x00058] in <db147fad2aa9412c845ff0ead92dfe20>:0 at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/Foundation/NSObject2.cs:147 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0003f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:69 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Dispose () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:37 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x00058] in <db147fad2aa9412c845ff0ead92dfe20>:0 at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/Foundation/NSObject2.cs:147 at Xamarin.Forms.Platform.iOS.DisposeHelpers.DisposeModalAndChildRenderers (Xamarin.Forms.Element view) [0x00041] in D:\a\1\s\Xamarin.Forms.Platform.iOS\DisposeHelpers.cs:23 at Xamarin.Forms.Platform.iOS.Platform.System.IDisposable.Dispose () [0x00048] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:83 at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.UpdateMainPage () [0x00022] in D:\a\1\s\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:181 at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.ApplicationOnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs args) [0x00012] in D:\a\1\s\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:142 at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:211 at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:353 at Xamarin.Forms.Application.set_MainPage (Xamarin.Forms.Page value) [0x00092] in D:\a\1\s\Xamarin.Forms.Core\Application.cs:105 at FTAC.CS.clsWebservice+<>c.<Verification_Login>b__1_2 () [0x00017] in C:\Dev\5\FTAC\FTAC\FTAC\CS\clsWebservice.cs:37 at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/Foundation/NSAction.cs:152 at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/UIKit/UIApplication.cs:79 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.8.0.2/src/Xamarin.iOS/UIKit/UIApplication.cs:63 at FTAC.iOS.Application.Main (System.String[] args) [0x00002] in C:\Dev\5\FTAC\FTAC\FTAC.iOS\Main.cs:19
The text was updated successfully, but these errors were encountered: