baskren / Forms9Patch

Simplify image management and text formatting in your Xamarin.Forms apps
http://Forms9Patch.com
Other
128 stars 33 forks source link

GetLoadAsAnimation' in type 'Forms9Patch.Image' from assembly 'Forms9Patch #36

Closed jitendrajadav closed 4 years ago

jitendrajadav commented 4 years ago

Updated 2.1.3 version and getting error please check below detail

System.TypeLoadException: 'Method 'GetLoadAsAnimation' in type 'Forms9Patch.Image' from assembly 'Forms9Patch, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.'

Installed Version: Professional

Visual C++ 2019 00435-60000-00000-AA694 Microsoft Visual C++ 2019

Xamarin 16.4.000.306 (d16-4@564b8d0) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.4.0.464 (remotes/origin/d16-4@4abf337c3) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.4.25 (579ee62) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.1.1.0 (d16-4/f2c9364) Xamarin.Android Reference Assemblies and MSBuild support. Mono: bef1e63 Java.Interop: xamarin/java.interop/d16-4@c4e569f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.28.0@46204c4 Xamarin.Android Tools: xamarin/xamarin-android-tools/master@9f4ed4b

Xamarin.iOS and Xamarin.Mac SDK 13.8.3.0 (0d8fe21) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Expected Result : It should work as earlier version

Actual Result : Getting exception System.TypeLoadException: 'Method 'GetLoadAsAnimation' in type 'Forms9Patch.Image' from assembly 'Forms9Patch, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an

baskren commented 4 years ago

@jitendrajadav - There isn't enough information here to understand what you are seeing. Can you send me a small demo project that produces this error?

jitendrajadav commented 4 years ago

It is very simple, update your 'Forms9Patch version to 2.1.3 and once you run application it is throw and exception in a starting main page like what I have posted in above detail, meanwhile I am creating simple demo application and posting to GitHub in short while

jitendrajadav commented 4 years ago

Please check demo: https://github.com/jitendrajadav/XamarinRealm.git

baskren commented 4 years ago

Thank you for the demo - it was pretty much the only way I could find the root cause. Looks like the issue was triggered by a change made by Xamarin in version 4.4. I've added a fix to the source code. Once I complete some work on the UWP version, I'll be releasing version 2.2 which will have this fixed.

jitendrajadav commented 4 years ago

@baskren Thank you very much :)

pettys commented 4 years ago

Just to add a note in case this affects anyone else, I've been struggling with something that looks like the same issue, slightly different error message. Steps to reproduce from a File > New Xamarin Project are below. Backing Xamarin.Forms down to 4.3 makes the problem go away.

@baskren Thanks for commenting so promptly on this issue. Been trying to identify the cause of this issue for several hours now. Some days, Xamarin feels like a house of cards.

12-17 09:54:02.175 I/MonoDroid(20852): UNHANDLED EXCEPTION:
12-17 09:54:02.181 I/MonoDroid(20852): System.TypeLoadException: VTable setup of type Forms9Patch.Image failed
12-17 09:54:02.181 I/MonoDroid(20852):   at Forms9Patch.Frame..ctor () [0x00000] in C:\Users\ben\Development\Xamarin\Forms9Patch\Forms9Patch\Forms9Patch\Layouts\Frame.cs:21 
12-17 09:54:02.181 I/MonoDroid(20852):   at Forms9Patch.ModalPopup..ctor (System.TimeSpan popAfter) [0x00008] in C:\Users\ben\Development\Xamarin\Forms9Patch\Forms9Patch\Forms9Patch\Elements\Popups\ModalPopup.cs:88 
12-17 09:54:02.181 I/MonoDroid(20852):   at MobileApp1.ViewModels.AboutViewModel+<>c.<.ctor>b__0_1 () [0x00080] in c:\code\MobileApp1\MobileApp1\MobileApp1\ViewModels\AboutViewModel.cs:19 
12-17 09:54:02.181 I/MonoDroid(20852):   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 
12-17 09:54:02.181 I/MonoDroid(20852):   at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <11f101b564894ca7af6c482ddc51c698>:0 
12-17 09:54:02.181 I/MonoDroid(20852):   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <11f101b564894ca7af6c482ddc51c698>:0 
12-17 09:54:02.181 I/MonoDroid(20852):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <11f101b564894ca7af6c482ddc51c698>:0 
12-17 09:54:02.181 I/MonoDroid(20852):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.98(intptr,intptr)
12-17 09:54:02.196 W/name.mobileapp(20852): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
12-17 09:54:02.198 D/Mono    (20852): DllImport searching in: '__Internal' ('(null)').
12-17 09:54:02.199 D/Mono    (20852): Searching for 'java_interop_jnienv_throw'.
12-17 09:54:02.199 D/Mono    (20852): Probing 'java_interop_jnienv_throw'.
12-17 09:54:02.199 D/Mono    (20852): Found as 'java_interop_jnienv_throw'.
**System.TypeLoadException:** 'VTable setup of type Forms9Patch.Image failed'

12-17 09:54:04.657 E/mono    (20852): 
12-17 09:54:04.657 E/mono    (20852): Unhandled Exception:
12-17 09:54:04.657 E/mono    (20852): System.TypeLoadException: VTable setup of type Forms9Patch.Image failed
12-17 09:54:04.657 E/mono    (20852):   at Forms9Patch.Frame..ctor () [0x00000] in C:\Users\ben\Development\Xamarin\Forms9Patch\Forms9Patch\Forms9Patch\Layouts\Frame.cs:21 
12-17 09:54:04.657 E/mono    (20852):   at Forms9Patch.ModalPopup..ctor (System.TimeSpan popAfter) [0x00008] in C:\Users\ben\Development\Xamarin\Forms9Patch\Forms9Patch\Forms9Patch\Elements\Popups\ModalPopup.cs:88 
12-17 09:54:04.657 E/mono    (20852):   at MobileApp1.ViewModels.AboutViewModel+<>c.<.ctor>b__0_1 () [0x00080] in c:\code\MobileApp1\MobileApp1\MobileApp1\ViewModels\AboutViewModel.cs:19 
12-17 09:54:04.657 E/mono    (20852):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.98(intptr,intptr)
12-17 09:54:04.657 E/mono    (20852):   at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.98(intptr,intptr)
12-17 09:54:04.659 E/mono-rt (20852): [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: VTable setup of type Forms9Patch.Image failed
12-17 09:54:04.659 E/mono-rt (20852):   at Forms9Patch.Frame..ctor () [0x00000] in C:\Users\ben\Development\Xamarin\Forms9Patch\Forms9Patch\Forms9Patch\Layouts\Frame.cs:21 
12-17 09:54:04.659 E/mono-rt (20852):   at Forms9Patch.ModalPopup..ctor (System.TimeSpan popAfter) [0x00008] in C:\Users\ben\Development\Xamarin\Forms9Patch\Forms9Patch\Forms9Patch\Elements\Popups\ModalPopup.cs:88 
12-17 09:54:04.659 E/mono-rt (20852):   at MobileApp1.ViewModels.AboutViewModel+<>c.<.ctor>b__0_1 () [0x00080] in c:\code\MobileApp1\MobileApp1\MobileApp1\ViewModels\AboutViewModel.cs:19 
12-17 09:54:04.659 E/mono-rt (20852):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.98(intptr,intptr)
12-17 09:54:04.659 E/mono-rt (20852):   at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.98(intptr,intptr)

Steps

  1. Create a new Xamarin project in Visual Studio (I'm using 2019 v16.4.1). I chose the Master/Detail template, and the project references Xamarin.Forms v4.4.0.991265.
  2. Add Forms9Patch.Droid.Settings.Initialize(this); code to MainActivity.cs just before LoadApplication.
  3. Add a button to the About page that shows a Forms9Patch ModalPopup:
    OpenPopupCommand = new Command(async () => {
    var content = new StackLayout { Orientation = StackOrientation.Vertical };
    content.Children.Add(new Label { Text = "Hello, World." });
    var btn = new Button { Text = "Dismiss" };
    content.Children.Add(btn);
    var popup = new Forms9Patch.ModalPopup();
    btn.Clicked += async (s, a) => await popup.PopAsync();
    await popup.PushAsync();
    });
  4. When that button on the app is clicked, the app crashes with the above info.
Estevete commented 4 years ago

@baskren Same problem here. When do you expect releasing v2.2? Thanks!

baskren commented 4 years ago

later this week. Working through a number of UWP related issues.

baskren commented 4 years ago

@pettys - thank you for sharing the level of detail you did. Short of a demo project, what you have done is usually necessary to make any progress on an issue.

baskren commented 4 years ago

Version 2.2 is now available with this issue fixed

jitendrajadav commented 4 years ago

Hi @baskren Could you please confirm I am still not able to get "Version 2.2" Thank you

baskren commented 4 years ago

My apologies. Forgot to click [SUBMIT] on the upload at NuGet.org. It should be available any moment.

jitendrajadav commented 4 years ago

Yes I am able to get it @baskren Thank you very much :)

gsgou commented 4 years ago

@baskren tks for your support. I also have the issue described above on v2.2.6 with XF 4.4.0.991864. Any known working XF build in 4.4 ? https://github.com/baskren/Forms9Patch/issues/36#issuecomment-566628807