Hello @MichaelRidland , I have a bug I'd like to report that's driving me nuts for the past few days.
When I try to resolve a page model, very often I get an exception, more precisely a TinyIoCResolutionException
I thought I have a bad code, or some bad IOC Registrations, but I turned everything off and I am trying the same with an empty PageModel + empty Page and still get the exception thrown.
I tried cleaning - rebuilding the project. I've also tried deleting all bin and obj folders throughout the solution, still no success.
Sometimes the PageModel is resolved without a problem, and the next minute it fails again. It's really driving me crazy.
I am using the new .Net standard type of Xamarin projects.
Here is my app.xaml.cs:
public App()
{
InitializeComponent();
MainPage = FreshMvvm.FreshPageModelResolver.ResolvePageModel<APageModel>();
}
Here is the empty page model (In the PageModels namespace of course):
public class APageModel : FreshMvvm.FreshBasePageModel
{
public APageModel()
{
}
}
As well as the xaml page:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="FitGirlsDiary.Pages.APage">
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
Here is the long and detailed Output Window:
01-31 15:29:55.998 D/Mono ( 7407): Found as 'java_interop_jnienv_get_static_field_id'.
01-31 15:29:56.001 D/Mono ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.001 D/Mono ( 7407): Searching for 'java_interop_jnienv_get_static_int_field'.
01-31 15:29:56.001 D/Mono ( 7407): Probing 'java_interop_jnienv_get_static_int_field'.
01-31 15:29:56.001 D/Mono ( 7407): Found as 'java_interop_jnienv_get_static_int_field'.
01-31 15:29:56.010 D/Mono ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.010 D/Mono ( 7407): Searching for 'java_interop_jnienv_call_void_method_a'.
01-31 15:29:56.010 D/Mono ( 7407): Probing 'java_interop_jnienv_call_void_method_a'.
01-31 15:29:56.010 D/Mono ( 7407): Found as 'java_interop_jnienv_call_void_method_a'.
01-31 15:29:56.018 D/Mono ( 7407): Assembly Ref addref Xamarin.Forms.Platform.Android[0xb2f3c6c0] -> System[0xb2f3daa0]: 3
01-31 15:29:56.018 D/Mono ( 7407): Assembly Ref addref Xamarin.Forms.Core[0xb2f3c600] -> System.Core[0xb2f3d3e0]: 5
01-31 15:29:56.037 D/Mono ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.037 D/Mono ( 7407): Searching for 'java_interop_jnienv_call_boolean_method_a'.
01-31 15:29:56.037 D/Mono ( 7407): Probing 'java_interop_jnienv_call_boolean_method_a'.
01-31 15:29:56.037 D/Mono ( 7407): Found as 'java_interop_jnienv_call_boolean_method_a'.
01-31 15:29:56.042 D/Mono ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.042 D/Mono ( 7407): Searching for 'java_interop_jnienv_get_field_id'.
01-31 15:29:56.042 D/Mono ( 7407): Probing 'java_interop_jnienv_get_field_id'.
01-31 15:29:56.042 D/Mono ( 7407): Found as 'java_interop_jnienv_get_field_id'.
01-31 15:29:56.045 D/Mono ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.045 D/Mono ( 7407): Searching for 'java_interop_jnienv_get_int_field'.
01-31 15:29:56.045 D/Mono ( 7407): Probing 'java_interop_jnienv_get_int_field'.
01-31 15:29:56.045 D/Mono ( 7407): Found as 'java_interop_jnienv_get_int_field'.
01-31 15:29:56.079 D/Mono ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.079 D/Mono ( 7407): Searching for 'java_interop_jnienv_get_float_field'.
01-31 15:29:56.079 D/Mono ( 7407): Probing 'java_interop_jnienv_get_float_field'.
01-31 15:29:56.079 D/Mono ( 7407): Found as 'java_interop_jnienv_get_float_field'.
01-31 15:29:56.104 D/Mono ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.104 D/Mono ( 7407): Searching for 'java_interop_jnienv_new_int_array'.
01-31 15:29:56.104 D/Mono ( 7407): Probing 'java_interop_jnienv_new_int_array'.
01-31 15:29:56.104 D/Mono ( 7407): Found as 'java_interop_jnienv_new_int_array'.
01-31 15:29:56.106 D/Mono ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.106 D/Mono ( 7407): Searching for 'java_interop_jnienv_set_int_array_region'.
01-31 15:29:56.106 D/Mono ( 7407): Probing 'java_interop_jnienv_set_int_array_region'.
01-31 15:29:56.106 D/Mono ( 7407): Found as 'java_interop_jnienv_set_int_array_region'.
01-31 15:29:56.109 D/Mono ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.109 D/Mono ( 7407): Searching for 'java_interop_jnienv_get_int_array_region'.
01-31 15:29:56.109 D/Mono ( 7407): Probing 'java_interop_jnienv_get_int_array_region'.
01-31 15:29:56.109 D/Mono ( 7407): Found as 'java_interop_jnienv_get_int_array_region'.
01-31 15:29:56.151 D/Mono ( 7407): Assembly Ref addref Xamarin.Forms.Platform.Android[0xb2f3c6c0] -> FormsViewGroup[0xb40ad280]: 2
01-31 15:29:56.169 D/Mono ( 7407): Assembly Ref addref FitGirlsDiary[0xb40ad100] -> mscorlib[0xb40ad0a0]: 36
01-31 15:29:56.169 D/Mono ( 7407): The request to load the retargetable assembly mscorlib v2.0.5.0 was remapped to mscorlib v2.0.5.0
01-31 15:29:56.169 D/Mono ( 7407): Assembly Ref addref FreshIOC[0xb40ad580] -> mscorlib[0xb40ad0a0]: 37
01-31 15:29:56.169 D/Mono ( 7407): Remapped public key token of retargetable assembly System.Core from 7cec85d7bea7798e to b77a5c561934e089
01-31 15:29:56.169 D/Mono ( 7407): The request to load the retargetable assembly System.Core v2.0.5.0 was remapped to System.Core v2.0.5.0
01-31 15:29:56.170 D/Mono ( 7407): Unloading image System.Core.dll [0x9ca4e000].
01-31 15:29:56.170 D/Mono ( 7407): Image addref System.Core[0x9cd28a20] -> System.Core.dll[0x9cfb7000]: 5
01-31 15:29:56.170 D/Mono ( 7407): Config attempting to parse: 'System.Core.dll.config'.
01-31 15:29:56.171 D/Mono ( 7407): Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Core/System.Core.config'.
01-31 15:29:56.171 D/Mono ( 7407): Assembly Ref addref FreshIOC[0xb40ad580] -> System.Core[0xb2f3d3e0]: 6
01-31 15:29:56.171 D/Mono ( 7407): Assembly Ref addref FreshMvvm[0xb40ad460] -> mscorlib[0xb40ad0a0]: 38
01-31 15:29:56.172 D/Mono ( 7407): Assembly Ref addref Realm.DataBinding[0xb40ad700] -> mscorlib[0xb40ad0a0]: 39
01-31 15:29:56.172 D/Mono ( 7407): Assembly Ref addref Realm[0xb40ad820] -> mscorlib[0xb40ad0a0]: 40
01-31 15:29:56.173 D/Mono ( 7407): Assembly Ref addref Realm.Sync[0xb40ad760] -> mscorlib[0xb40ad0a0]: 41
01-31 15:29:56.173 D/Mono ( 7407): Assembly Ref addref Realm.Sync[0xb40ad760] -> Realm[0xb40ad820]: 2
01-31 15:29:56.173 D/Mono ( 7407): Assembly Ref addref Remotion.Linq[0xb40adac0] -> mscorlib[0xb40ad0a0]: 42
01-31 15:29:56.174 D/Mono ( 7407): Assembly Ref addref System.Runtime.CompilerServices.Unsafe[0xb40adb20] -> mscorlib[0xb40ad0a0]: 43
01-31 15:29:56.176 D/Mono ( 7407): Assembly Ref addref Xamarin.Forms.Platform[0xb2f3c780] -> mscorlib[0xb40ad0a0]: 44
01-31 15:29:56.176 D/Mono ( 7407): Assembly Ref addref Xamarin.Forms.Xaml[0xb2f3c840] -> mscorlib[0xb40ad0a0]: 45
01-31 15:29:56.176 D/Mono ( 7407): Assembly Ref addref Xamarin.Forms.Xaml[0xb2f3c840] -> Xamarin.Forms.Core[0xb2f3c600]: 5
01-31 15:29:56.176 D/Mono ( 7407): Assembly Ref addref FitGirls.TransferLayer[0xb2f3c900] -> mscorlib[0xb40ad0a0]: 46
01-31 15:29:56.176 D/Mono ( 7407): Assembly Ref addref FitGirls.Data[0xb2f3c9c0] -> mscorlib[0xb40ad0a0]: 47
01-31 15:29:56.177 D/Mono ( 7407): Assembly Ref addref System.Linq[0xb2f3d2c0] -> mscorlib[0xb40ad0a0]: 48
01-31 15:29:56.179 D/Mono ( 7407): Assembly Ref addref System.Xml[0xb2f3ee80] -> mscorlib[0xb40ad0a0]: 49
01-31 15:29:56.193 D/Mono ( 7407): Assembly Ref addref FitGirlsDiary[0xb40ad100] -> FreshMvvm[0xb40ad460]: 2
01-31 15:29:56.193 D/Mono ( 7407): Assembly Ref addref FreshMvvm[0xb40ad460] -> System[0xb2f3daa0]: 4
01-31 15:29:56.193 D/Mono ( 7407): Assembly Ref addref FreshMvvm[0xb40ad460] -> Xamarin.Forms.Core[0xb2f3c600]: 6
Resolved pending breakpoint at 'App.xaml.cs:30,1' to void FitGirlsDiary.App..ctor () [0x0000f].
01-31 15:29:56.221 D/Mono ( 7407): Assembly Ref addref Xamarin.Forms.Core[0xb2f3c600] -> Xamarin.Forms.Platform[0xb2f3c780]: 2
01-31 15:29:56.286 D/Mono ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.286 D/Mono ( 7407): Searching for 'java_interop_jnienv_call_int_method_a'.
01-31 15:29:56.286 D/Mono ( 7407): Probing 'java_interop_jnienv_call_int_method_a'.
01-31 15:29:56.286 D/Mono ( 7407): Found as 'java_interop_jnienv_call_int_method_a'.
01-31 15:29:56.298 D/Mono ( 7407): Assembly Ref addref FitGirlsDiary[0xb40ad100] -> Xamarin.Forms.Xaml[0xb2f3c840]: 2
01-31 15:29:56.300 D/Mono ( 7407): Assembly Ref addref Xamarin.Forms.Xaml[0xb2f3c840] -> System.Xml[0xb2f3ee80]: 3
01-31 15:29:56.309 D/Mono ( 7407): Assembly Ref addref Xamarin.Forms.Xaml[0xb2f3c840] -> System[0xb2f3daa0]: 5
01-31 15:29:56.498 D/Mono ( 7407): Assembly Ref addref System.Xml[0xb2f3ee80] -> System[0xb2f3daa0]: 6
01-31 15:29:56.684 D/Mono ( 7407): Assembly Ref addref Xamarin.Forms.Xaml[0xb2f3c840] -> System.Core[0xb2f3d3e0]: 7
01-31 15:29:59.979 D/Mono ( 7407): Assembly Ref addref FreshMvvm[0xb40ad460] -> FreshIOC[0xb40ad580]: 2
Unhandled Exception:
FreshTinyIoC.TinyIoCResolutionException: Resolve failed: APageModel
Here is the output window after I try clicking on Continue. I believe it may have some valueable info...
01-31 15:35:06.612 D/Mono ( 7407): DllImport attempting to load: '/system/lib/liblog.so'.
01-31 15:35:06.612 D/Mono ( 7407): DllImport loaded library '/system/lib/liblog.so'.
01-31 15:35:06.612 D/Mono ( 7407): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
01-31 15:35:06.612 D/Mono ( 7407): Searching for '__android_log_print'.
01-31 15:35:06.612 D/Mono ( 7407): Probing '__android_log_print'.
01-31 15:35:06.612 D/Mono ( 7407): Found as '__android_log_print'.
01-31 15:35:06.618 I/MonoDroid( 7407): UNHANDLED EXCEPTION:
01-31 15:35:06.660 I/MonoDroid( 7407): FreshTinyIoC.TinyIoCResolutionException: Resolve failed: APageModel
01-31 15:35:06.660 I/MonoDroid( 7407): at FreshTinyIoC.FreshTinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) [0x0005f] in <88d288788c3d4f6eac793c4b6e65bc37>:0
01-31 15:35:06.660 I/MonoDroid( 7407): at FreshTinyIoC.FreshTinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) [0x00000] in <88d288788c3d4f6eac793c4b6e65bc37>:0
01-31 15:35:06.660 I/MonoDroid( 7407): at FreshTinyIoC.FreshTinyIoCContainer.ResolveInternal (FreshTinyIoC.FreshTinyIoCContainer+TypeRegistration registration, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) [0x001ba] in <88d288788c3d4f6eac793c4b6e65bc37>:0
01-31 15:35:06.660 I/MonoDroid( 7407): at FreshTinyIoC.FreshTinyIoCContainer.Resolve (System.Type resolveType) [0x00011] in <88d288788c3d4f6eac793c4b6e65bc37>:0
01-31 15:35:06.660 I/MonoDroid( 7407): at FreshTinyIoC.FreshTinyIoCContainer.Resolve[ResolveType] () [0x00000] in <88d288788c3d4f6eac793c4b6e65bc37>:0
01-31 15:35:06.660 I/MonoDroid( 7407): at FreshMvvm.FreshTinyIOCBuiltIn.Resolve[ResolveType] () [0x00000] in /Users/michaelridland/Projects/FreshMvvm/src/FreshMvvm/FreshTinyIOCBuiltIn.cs:36
01-31 15:35:06.660 I/MonoDroid( 7407): at FreshMvvm.FreshPageModelResolver.ResolvePageModel[T] (System.Object initData) [0x00000] in /Users/michaelridland/Projects/FreshMvvm/src/FreshMvvm/FreshPageModelResolver.cs:17
01-31 15:35:06.660 I/MonoDroid( 7407): at FreshMvvm.FreshPageModelResolver.ResolvePageModel[T] () [0x00000] in /Users/michaelridland/Projects/FreshMvvm/src/FreshMvvm/FreshPageModelResolver.cs:12
01-31 15:35:06.660 I/MonoDroid( 7407): at FitGirlsDiary.App..ctor () [0x0000f] in D:\Development\VisualStudio\Projects\FitGirlsDiary_Repo\FitGirlsDiary\FitGirlsDiary\App.xaml.cs:30
01-31 15:35:06.660 I/MonoDroid( 7407): at FitGirlsDiary.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00027] in D:\Development\VisualStudio\Projects\FitGirlsDiary_Repo\FitGirlsDiary\FitGirlsDiary.Android\MainActivity.cs:23
01-31 15:35:06.660 I/MonoDroid( 7407): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <28e323a707a2414f8b493f6d4bb27c8d>:0
01-31 15:35:06.660 I/MonoDroid( 7407): at (wrapper dynamic-method) System.Object:66a74b74-0063-4811-8a6f-05873ff0d85c (intptr,intptr,intptr)
01-31 15:35:06.678 W/art ( 7407): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
01-31 15:35:06.682 D/Mono ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:35:06.682 D/Mono ( 7407): Searching for 'java_interop_jnienv_throw'.
01-31 15:35:06.682 D/Mono ( 7407): Probing 'java_interop_jnienv_throw'.
01-31 15:35:06.682 D/Mono ( 7407): Found as 'java_interop_jnienv_throw'.
An unhandled exception occured.
For reference, here is a snapshot that all my FreshMvvm versions are the same: