GiampaoloGabba / Xamarin.Plugin.SharedTransitions

Shared Element Transitions between pages in Xamarin.Forms (IOS/Android)
MIT License
414 stars 57 forks source link

Failed to lookup the required marshalling information #31

Closed gsalve closed 4 years ago

gsalve commented 4 years ago

Bug Information

Version Number of Plugin: 2.1.0 Device Tested On: iPhone Simulator Tested On: iPhone 11,( 13.4) Version of VS: 8.5.2 Version of Xamarin: 4.5.0.617 Versions of other things you are using:

Steps to reproduce the Behavior

ObjCRuntime.RuntimeException: Failed to lookup the required marshalling information. Additional information: Selector: stopAnimating Type: Xamarin_Forms_Platform_iOS_FormsUIImageView ---> ObjCRuntime.RuntimeException: Failed to get the 'this' instance in a method call to Xamarin.Forms.Platform.iOS.FormsUIImageView.StopAnimating. ---> ObjCRuntime.RuntimeException: Failed to marshal the Objective-C object 0x7ff67a4693b0 (type: Xamarin_Forms_Platform_iOS_FormsUIImageView). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'Xamarin.Forms.Platform.iOS.FormsUIImageView' does not have a constructor that takes one IntPtr argument). at ObjCRuntime.Runtime.MissingCtor (System.IntPtr ptr, System.IntPtr klass, System.Type type, ObjCRuntime.Runtime+MissingCtorResolution resolution) [0x00039] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:1100 at ObjCRuntime.Runtime.ConstructNSObject[T] (System.IntPtr ptr, System.Type type, ObjCRuntime.Runtime+MissingCtorResolution missingCtorResolution) [0x00024] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:1129 at ObjCRuntime.Runtime.ConstructNSObject (System.IntPtr ptr, System.IntPtr klass, ObjCRuntime.Runtime+MissingCtorResolution missingCtorResolution) [0x00010] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:1108 at ObjCRuntime.Runtime.GetNSObject (System.IntPtr ptr, ObjCRuntime.Runtime+MissingCtorResolution missingCtorResolution, System.Boolean evenInFinalizerQueue) [0x0001c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:1241 at Registrar.DynamicRegistrar.GetMethodDescriptionAndObject (System.Type type, System.IntPtr selector, System.Boolean is_static, System.IntPtr obj, System.IntPtr& mthis, System.IntPtr desc) [0x0004b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/ObjCRuntime/DynamicRegistrar.cs:867 --- End of inner exception stack trace --- at Registrar.DynamicRegistrar.GetMethodDescriptionAndObject (System.Type type, System.IntPtr selector, System.Boolean is_static, System.IntPtr obj, System.IntPtr& mthis, System.IntPtr desc) [0x00089] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/ObjCRuntime/DynamicRegistrar.cs:874 at ObjCRuntime.Runtime.GetMethodAndObjectForSelector (System.IntPtr klass, System.IntPtr sel, System.Boolean is_static, System.IntPtr obj, System.IntPtr& mthis, System.IntPtr desc) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:744 at ObjCRuntime.Runtime.get_method_and_object_for_selector (System.IntPtr cls, System.IntPtr sel, System.Boolean is_static, System.IntPtr obj, System.IntPtr& mthis, System.IntPtr desc, System.Int32& exception_gchandle) [0x00004] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/runtime/Delegates.generated.cs:431 --- End of inner exception stack trace --- at 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/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:86 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:65 at TransitionApp.iOS.Application.Main (System.String[] args) [0x00001] in /Users/ganesh/Downloads/Xamarin.Plugin.SharedTransitions-master/src/Sample/TransitionApp/TransitionApp.iOS/Main.cs:17

gsalve commented 4 years ago

Issue is Plugin.SharedTransitions.Platforms.iOS.ViewExtensions Line 91 NSKeyedUnarchiver.UnarchiveObject throwing this error.

GiampaoloGabba commented 4 years ago

ummm.... i tought i fixed that. Are you animating a custom view or something generated by a plugin ?

sthewissen commented 4 years ago

I have encountered this same issue and it should be reproducible in this repo: https://github.com/sthewissen/coffeeffee

GiampaoloGabba commented 4 years ago

thank you! i stopped the release of the new version (compatible with androidx) to fix this issue. it could be in the next couple of days.

Maybe i'm tryuing to optimize the animation too much and need to stop do duplicating views when i can and just take a snapshot, but then i cant animate borders, ecc

GiampaoloGabba commented 4 years ago

ah found it! it has something to do with CG. And when i copy the object it has to be recreated but the Unarchiver needs a constructor wich get an IntPtr as param but the FormsUIIMageView in Xf.Core doesnt have that. Soooo, if this plugin was in core i will be able to fix this with just 1 line of code :( For now i have to do something more creative :)

sthewissen commented 4 years ago

Awesome!