I have a physical device connected. When the phone is locked and I deploy the application after unlocking, the application works and everything is fine. But if the screen is unlocked and I deploy I get the following error. In this case, everything is ok on the emulator. Help me understand this nonsense.
**System.NullReferenceException:** 'Object reference not set to an instance of an object.'
[HotReload] (2021-03-17 23:08:35.2): INFO: Инициализация горячей перезагрузки XAML…
[HotReload] (2021-03-17 23:08:35.2): WARN: (DriverHelper v 2.0.Android) Unknown Breakpoint Hit: Android.Runtime.JNIEnv.RegisterJniNatives( typeName_ptr, int typeName_len, jniClass, methods_ptr, int methods_len)
"<unnamed thread>" at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Diagnostics.Debugger.Mono_UnhandledException_internal (System.Exception) <0x00007>
at System.Diagnostics.Debugger.Mono_UnhandledException (System.Exception) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Diagnostics/Debugger.cs:125
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.46 (intptr,intptr) [0x00020] in <44e54a86dea24313a2bdb807df77c27a>:0
at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.46 (intptr,intptr) [0x00033] in <44e54a86dea24313a2bdb807df77c27a>:0
"ProtocolHandler.SendThread" at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Threading.Monitor.Monitor_wait (object,int) <0x00007>
at System.Threading.Monitor.ObjWait (bool,int,object) [0x0002f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Threading/Monitor.cs:85
at System.Threading.Monitor.Wait (object,int,bool) [0x0000e] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/monitor.cs:218
at System.Threading.Monitor.Wait (object) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/monitor.cs:238
at Microsoft.VisualStudio.DesignTools.TapContract.Networking.ProtocolHandler/WaitableActionsList.WaitForData () [0x00019] in <c37c1589af144356b99fb170c5e22242>:0
at Microsoft.VisualStudio.DesignTools.TapContract.Networking.ProtocolHandler.ActionThread (object) [0x00045] in <c37c1589af
144356b99fb170c5e22242>:0
at System.Threading.ThreadHelper.ThreadStart_Context (object) [0x00025] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/thread.cs:78
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00071] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object) [0x0002b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/
03-17 23:08:49.317 E/mono (27416): Full thread dump:referencesource/mscorlib/system/threading/executioncontext.cs:899
at System.Threading.ThreadHelper.ThreadStart (object) [0x0000f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/thread.cs:93
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) [0x0006b] in <c72658f647bc485bbfb8c9fcaa790862>:0
"<threadpool thread>"
"Debugger agent"
"Thread Pool Worker"
"Thread Pool Worker"
"Thread Pool Worker"
"Timer-Scheduler"
"Finalizer"
"ProtocolHandler.ProcessThread" at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Threading.Monitor.Monitor_wait (object,int) <0x00007>
at System.Threading.Monitor.ObjWait (bool,int,object) [0x0002f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Threading/Monitor.cs:85
at System.Threading.Monitor.Wait (object,int,bool) [0x0000e] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android
/release/mcs/class/referencesource/mscorlib/system/threading/monitor.cs:218
at System.Threading.Monitor.Wait (object) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/monitor.cs:238
at Microsoft.VisualStudio.DesignTools.TapContract.Networking.ProtocolHandler/WaitableActionsList.WaitForData () [0x00019] in <c37c1589af144356b99fb170c5e22242>:0
at Microsoft.VisualStudio.DesignTools.TapContract.Networking.ProtocolHandler.ActionThread (object) [0x00045] in <c37c1589af144356b99fb170c5e22242>:0
at System.Threading.ThreadHelper.ThreadStart_Context (object) [0x00025] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/thread.cs:78
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00071] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/re
ferencesource/mscorlib/system/threading/executioncontext.cs:968
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object) [0x0002b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:899
at System.Threading.ThreadHelper.ThreadStart (object) [0x0000f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/thread.cs:93
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) [0x0006b] in <c72658f647bc485bbfb8c9fcaa790862>:0
"ProtocolHandler.ReadThread" at <unknow
n> <0xffffffff>
at (wrapper managed-to-native) System.Threading.Monitor.Monitor_wait (object,int) <0x00007>
at System.Threading.Monitor.ObjWait (bool,int,object) [0x0002f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Threading/Monitor.cs:85
at System.Threading.Monitor.Wait (object,int,bool) [0x0000e] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/monitor.cs:218
at System.Threading.Monitor.Wait (object) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/monitor.cs:238
at Xamarin.HotReload.HotReloadAgent.Microsoft.VisualStudio.DesignTools.TapContract.Networking.IDataBridge.ReadMessage () [0x0002f] in D:\a\1\s\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:341
at Microsoft.VisualStudio.DesignTools.TapContract.Networking.ProtocolHandler.ReadThread () [0x00038] in <c37c1589af144356b99fb170c
5e22242>:0
at System.Threading.ThreadHelper.ThreadStart_Context (object) [0x00014] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/thread.cs:74
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00071] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object) [0x0002b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource
/mscorlib/system/threading/executioncontext.cs:899
at System.Threading.ThreadHelper.ThreadStart () [0x00008] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/thread.cs:111
at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x00067] in <c72658f647bc485bbfb8c9fcaa790862>:0
Related
i am using realm.xamarin 0.75 with xamarin forms and while executing query, i get a weird error. the query is
DateTimeOffset fromOffset = new DateTimeOffset(fromDate);
DateTimeOffset toOffset = new DateTimeOffset(toDate);
var config = DependencyService.Get<IDatabase>().GetConfiguration();
using (var realm = Realm.GetInstance(config))
{
return realm.All<Measurements>()Where(o => o.CreatedDateTime >= fromOffset && o.CreatedDateTime <= toOffset).OrderByDescending(o => o.CreatedDateTime).ToList();
}
And the error is:
UNHANDLED EXCEPTION:
06-06 17:46:15.337 I/MonoDroid(26505): Realms.RealmException: Data type mismatch
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.NativeCommon.ExceptionThrower (NativeException exception) [0x00007] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at (wrapper native-to-managed) Realms.NativeCommon:ExceptionThrower (Realms.NativeException)
06-06 17:46:15.337 I/MonoDroid(26505): at (wrapper managed-to-native) Realms.NativeQuery:timestamp_milliseconds_greater_equal (Realms.QueryHandle,intptr,long)
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.AddQueryGreaterThanOrEqual (Realms.QueryHandle queryHandle, System.String columnName, System.Object value) [0x000b6] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.VisitBinary (System.Linq.Expressions.BinaryExpression b) [0x0016c] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.ExpressionVisitor.Visit (System.Linq.Expressions.Expression exp) [0x000d2] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.VisitCombination (System.Linq.Expressions.BinaryExpression b, System.Action`1 combineWith) [0x00012] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.VisitBinary (System.Linq.Expressions.BinaryExpression b) [0x0000c] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.ExpressionVisitor.Visit (System.Linq.Expressions.Expression exp) [0x000d2] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.VisitMethodCall (System.Linq.Expressions.MethodCallExpression m) [0x0006a] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.ExpressionVisitor.Visit (System.Linq.Expressions.Expression exp) [0x000ec] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResultsVisitor.VisitMethodCall (System.Linq.Expressions.MethodCallExpression m) [0x000e6] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.ExpressionVisitor.Visit (System.Linq.Expressions.Expression exp) [0x000ec] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResults`1[T].CreateResultsHandle () [0x00037] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResults`1[T].get_ResultsHandle () [0x0000d] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at Realms.RealmResults`1[T].GetEnumerator () [0x00000] in <filename unknown>:0
06-06 17:46:15.337 I/MonoDroid(26505): at System.Collections.Generic.List`1[T]..ctor (IEnumerable`1 collection) [0x00073] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/collections/generic/list.cs:104
06-06 17:46:15.337 I/MonoDroid(26505): at System.Linq.Enumerable.ToList[TSource] (IEnumerable`1 source) [0x00011] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/System.Core/System/Linq/Enumerable.cs:835
i suscpect DateTimeOffset could be causing the issue.
i checked the source code at https://github.com/realm/realm-dotnet
but couldn't find anything.
I found the issue. It happens when the class for RealmObject(in my case Measurements) is not inheriting directly from RealmObject.
My class Measurements was inheriting from a class BaseModel (i created this class for internal purpose) and this BaseModel class was inheriting from RealmObject.
When i removed this and made Measurements inherit directly from RealmObject, i doesn't throws exception.
From Dimitris Tavlikos 's comment,
Realm Xamarin does not allow models to be further subclassed in any way. The CreateObject generic method only works if you use it for a class which descends directly from RealmObject.
https://realm.io/docs/xamarin/latest/#model-inheritance
I'm trying to add Realm to my app (Xamarin Android). Starting with emulator first (Xaamrin android player - Nexus 5 with Android Lollipop).
Github Issue here
My code:
protected override async void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.MyActivitylayout);
....
try
{
var path = AndroidIoHelper.CreateFileInAppFolder(AndroidIoHelper.GetAppDataFolder(), "tlm_db", "realm");
var realm = Realm.GetInstance(path);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
.......
}
Exception I'm getting:
Realms.RealmFileAccessErrorException: Operation not permitted at
Realms.NativeCommon.ExceptionThrower (IntPtr exceptionCode, IntPtr
utf8String, IntPtr stringLen) [0x0003b] in :0 at
(wrapper native-to-managed) Realms.NativeCommon:ExceptionThrower
(intptr,intptr,intptr) at (wrapper managed-to-native)
Realms.NativeSharedRealm:open
(Realms.SchemaHandle,string,intptr,intptr,intptr,byte[],ulong) 05-15
12:57:18.384 I/mono-stdout( 5250):
Realms.RealmFileAccessErrorException: Operation not permitted 05-15
12:57:18.384 I/mono-stdout( 5250): at
Realms.NativeCommon.ExceptionThrower (IntPtr exceptionCode, IntPtr
utf8String, IntPtr stringLen) [0x0003b] in :0 05-15
12:57:18.384 I/mono-stdout( 5250): at (wrapper native-to-managed)
Realms.NativeCommon:ExceptionThrower (intptr,intptr,intptr) 05-15
12:57:18.385 I/mono-stdout( 5250): at (wrapper managed-to-native)
Realms.NativeSharedRealm:open
(Realms.SchemaHandle,string,intptr,intptr,intptr,byte[],ulong) 05-15
12:57:18.385 I/mono-stdout( 5250): at Realms.Realm.GetInstance
(Realms.RealmConfiguration config) [0x0010c] in :0
05-15 12:57:18.385 I/mono-stdout( 5250): at Realms.Realm.GetInstance
(System.String databasePath) [0x00019] in :0 05-15
12:57:18.385 I/mono-stdout( 5250): at
MyApp.Activities.SplashScreenActivity+d__4.MoveNext ()
[0x00116] in
C:\Users***\Source\Repos\AppName\MyApp\Activities\SplashScreenActivity.cs:66
at Realms.Realm.GetInstance (Realms.RealmConfiguration config)
[0x0010c] in :0 at Realms.Realm.GetInstance
(System.String databasePath) [0x00019] in :0 at
MyApp.Activities.SplashScreenActivity+d__4.MoveNext ()
[0x00116] in
C:\Users***\Source\Repos\AppName\MyApp\Activities\SplashScreenActivity.cs:66
If I don't specify path I'm getting (var realm = Realm.GetInstance();):
System.ArgumentNullException: Value cannot be null. Parameter name:
type at System.Activator.CreateInstance (System.Type type, Boolean
nonPublic) [0x00006] in
/Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/activator.cs:205
05-15 13:05:05.257 I/mono-stdout( 5474): System.ArgumentNullException:
Value cannot be null. 05-15 13:05:05.257 I/mono-stdout( 5474):
Parameter name: type 05-15 13:05:05.257 I/mono-stdout( 5474): at
System.Activator.CreateInstance (System.Type type, Boolean nonPublic)
[0x00006] in
/Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/activator.cs:205
05-15 13:05:05.257 I/mono-stdout( 5474): at
System.Activator.CreateInstance (System.Type type) [0x00000] in
/Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/activator.cs:147
at System.Activator.CreateInstance (System.Type type) [0x00000] in
/Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/activator.cs:147
at Realms.Realm.CreateRealmObjectMetadata (System.Type
realmObjectType) [0x0001e] in :0 at
System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement]
(IEnumerable1 source, System.Func2 keySelector, System.Func2
elementSelector, IEqualityComparer1 comparer) [0x0004d] in
/Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/System.Core/System/Linq/Enumerable.cs:855
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement]
(IEnumerable1 source, System.Func2 keySelector, System.Func2
elementSelector) [0x00000] in
/Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/System.Core/System/Linq/Enumerable.cs:847
at Realms.Realm..ctor (Realms.SharedRealmHandle sharedRealmHandle,
Realms.RealmConfiguration config) [0x00037] in <filename unknown>:0
at Realms .Realm.GetInstance (Realms.RealmConfiguration config)
[0x00171] in <filename unknown>:0 at
MyApp.Activities.SplashScreenActivity+<OnCreate>d__4.MoveNext ()
[0x00116] in
C:\Users\***\Source\Repos\AppName\MyApp\Activities\SplashScreenActivity.cs:66
05-15 13:05:05.257 I/mono-stdout( 5474): at
Realms.Realm.CreateRealmObjectMetadata (System.Type realmObjectType)
[0x0001e] in <filename unknown>:0 05-15 13:05:05.257 I/mono-stdout(
5474): at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement]
(IEnumerable1 source, System.Func2 keySelector, System.Func2
elementSelector, IEqualityComparer1 comparer) [0x0004d] in
/Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/System.Core/System/Linq/Enumerable.cs:855
05-15 13:05:05.257 I/mono-stdout( 5474): at
System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement]
(IEnumerable1 source, System.Func2 keySelector, System.Func2
elementSelector) [0x00000] in
/Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/System.Core/System/Linq/Enumerable.cs:847
05-15 13:05:05.257 I/mono-stdout( 5474): at Realms.Realm..ctor
(Realms.SharedRealmHandle sharedRealmHandle, Realms.RealmConfiguration
config) [0x00037] in :0 05-15 13:05:05.257
I/mono-stdout( 5474): at Realms.Realm.GetInstance
(Realms.RealmConfiguration config) [0x00171] in :0
05-15 13:05:05.257 I/mono-stdout( 5474): at
MyApp.Activities.SplashScreenActivity+d__4.MoveNext ()
[0x00116] in
C:\Users***\Source\Repos\AppName\MyApp\Activities\SplashScreenActivity.cs:66
The app has Write external storage permission.
Realm and Fody nuget packages installed properly, Fody weavers are present as expected..
It also crashes with same exception using HTC One X with Android 4.2
The above attempt had other issues. There is a real bug currently in Realm with storage on external storage - see the issue https://github.com/realm/realm-dotnet/issues/554 which is proving awkward to debug.
We upgraded from Mono 3.12.0 to 4.0.1 the other day and now our NUnit tests crash with a SIGABRT and some other information. So far Google has been of no help and I'm running out of things to try (minus a rollback to 3.12.0). I was just hoping someone could maybe take a look and help me find a new avenue to explore!enter code here
I've tried the --shadowcopy switch, the --framework=v4.0/mono-4.0 switch, etc.
Console Output:
matt#matt-T420:~/bah3$ ~/Downloads/nunit3/bin/nunit-console.exe --
framework=mono-4.0 -v src/bin/Bah.Test.dll -test=Bah.Test.Unit
NUnit Console Runner 3.0.5562
Copyright (C) 2014 Charlie Poole
Test Files
src/bin/Bah.Test.dll
Runtime Environment
OS Version: Unix 3.19.0.16
CLR Version: 4.0.30319.17020
Options
ProcessModel: Default DomainUsage: Default
Execution Runtime: mono-4.0
Work Directory: /home/matt/bah
Internal Trace: Off
Selected test(s):
bah.Test.Unit
Agent process 29586 starting
Running under version 4.0.30319.17020, 4.0.1 (tarball Tue Apr 28 11:47:58 UTC 2015)
=> Bah.Test.Unit.ApplicationSourceTests.ToString
[ApplicationSource: Base=[Source: Base=[BahEntity: Key=[Key: Type=Bah.Core.SourceTypes.ApplicationSource, Name=a1], Name=a1], SourceType=Application], Command=command]
System.Type[] doesn't implement interface Castle.DynamicProxy.IInvocation
Stacktrace:
at <unknown> <0xffffffff>
at Moq.Proxy.CastleProxyFactory/CallContext.get_Method () <0x00021>
at Moq.HandleDestructor.HandleIntercept (Moq.Proxy.ICallContext,Moq.InterceptorContext,Moq.CurrentInterceptContext) <0x0001d>
at Moq.Interceptor.Intercept (Moq.Proxy.ICallContext) <0x000b0>
at Moq.Proxy.CastleProxyFactory/Interceptor.Intercept (Castle.DynamicProxy.IInvocation) <0x00085>
at Castle.DynamicProxy.AbstractInvocation.Proceed () <0x0023e>
at Castle.Proxies.IRepositoryProxy.Load<T, DTO> (Bah.Core.IKey,System.Func`2<DTO, T>) <0x001d3>
at Bah.Core.RepositoryExtensions.LoadContainer (Bah.Core.IRepository,Bah.Core.IKey) <0x000b0>
at Bah.Test.Unit.ContainerTest.TestContainerLoad () <0x00703>
at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <0xffffffff>
at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <0xffffffff>
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x000f7>
at System.Reflection.MethodBase.Invoke (object,object[]) <0x0002a>
at NUnit.Core.Reflect.InvokeMethod (System.Reflection.MethodInfo,object,object[]) <0x0004f>
at NUnit.Core.TestMethod.RunTestMethod () <0x00053>
at NUnit.Core.TestMethod.RunTestCase (NUnit.Core.TestResult) <0x00027>
at NUnit.Core.TestMethod.RunTest () <0x0012f>
at NUnit.Core.NUnitTestMethod.RunTest () <0x0000f>
at NUnit.Core.TestMethod.RunRepeatedTest () <0x000c3>
at NUnit.Core.TestMethod.RunTestInContext () <0x00627>
at NUnit.Core.TestMethod.Run (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x000b3>
at NUnit.Core.TestSuite.RunAllTests (NUnit.Core.TestResult,NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00291>
at NUnit.Core.TestSuite.RunSuite (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x0049b>
at NUnit.Core.TestSuite.RunSuiteInContext (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00087>
at NUnit.Core.TestSuite.Run (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00083>
at NUnit.Core.TestFixture.Run (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00087>
at NUnit.Core.TestSuite.RunAllTests (NUnit.Core.TestResult,NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00291>
at NUnit.Core.TestSuite.RunSuite (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x0049b>
at NUnit.Core.TestSuite.RunSuiteInContext (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00087>
at NUnit.Core.TestSuite.Run (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00083>
at NUnit.Core.TestSuite.RunAllTests (NUnit.Core.TestResult,NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00291>
at NUnit.Core.TestSuite.RunSuite (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x0049b>
at NUnit.Core.TestSuite.RunSuiteInContext (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00087>
at NUnit.Core.TestSuite.Run (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00083>
at NUnit.Core.TestSuite.RunAllTests (NUnit.Core.TestResult,NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00291>
at NUnit.Core.TestSuite.RunSuite (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x0049b>
at NUnit.Core.TestSuite.RunSuiteInContext (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00087>
at NUnit.Core.TestSuite.Run (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00083>
at NUnit.Core.TestSuite.RunAllTests (NUnit.Core.TestResult,NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00291>
at NUnit.Core.TestSuite.RunSuite (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x0049b>
at NUnit.Core.TestSuite.RunSuiteInContext (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00087>
at NUnit.Core.TestSuite.Run (NUnit.Core.EventListener,NUnit.Core.ITestFilter) <0x00083>
at NUnit.Core.SimpleTestRunner.Run (NUnit.Core.EventListener,NUnit.Core.ITestFilter,bool,NUnit.Core.LoggingThreshold) <0x00130>
at NUnit.Core.TestRunnerThread.TestRunnerThreadProc () <0x00065>
at System.Threading.Thread.StartInternal () <0x00071>
at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
/usr/bin/mono() [0x4b1d6c]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10d10) [0x7f18fd533d10]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37) [0x7f18fd18e267]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f18fd18feca]
/usr/bin/mono() [0x629079]
/usr/bin/mono() [0x629287]
/usr/bin/mono() [0x629332]
/usr/bin/mono() [0x4b3d8f]
/usr/bin/mono() [0x4b45a3]
[0x40e62046]
Debug info from gdb:
Could not attach to process. If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No threads.
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
System.Runtime.Remoting.RemotingException: Connection refused
Server stack trace:
at System.Runtime.Remoting.Channels.Tcp.HostConnectionPool.CreateConnection () [0x00000] in <filename unknown>:0
at System.Runtime.Remoting.Channels.Tcp.HostConnectionPool.GetConnection () [0x00000] in <filename unknown>:0
at System.Runtime.Remoting.Channels.Tcp.TcpConnectionPool.GetConnection (System.String host, Int32 port) [0x00000] in <filename unknown>:0
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage (IMessage msg, ITransportHeaders requestHeaders, System.IO.Stream requestStream, ITransportHeaders& responseHeaders, System.IO.Stream& responseStream) [0x00000] in <filename unknown>:0
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage (IMessage msg) [0x00000] in <filename unknown>:0
Exception rethrown at [0]:
at System.Runtime.Remoting.Channels.Tcp.HostConnectionPool.CreateConnection () [0x00000] in <filename unknown>:0
at System.Runtime.Remoting.Channels.Tcp.HostConnectionPool.GetConnection () [0x00000] in <filename unknown>:0
at System.Runtime.Remoting.Channels.Tcp.TcpConnectionPool.GetConnection (System.String host, Int32 port) [0x00000] in <filename unknown>:0
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage (IMessage msg, ITransportHeaders requestHeaders, System.IO.Stream requestStream, ITransportHeaders& responseHeaders, System.IO.Stream& responseStream) [0x00000] in <filename unknown>:0
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage (IMessage msg) [0x00000] in <filename unknown>:0
Why does the below code fail at runtime?
MongoCollection<BsonDocument> tempCollection = DBHelper.GetInstance().TempCollection();
IList<BsonDocument> documents = (from d in tempCollection.AsQueryable()
where d["Form"].AsString == id
select d).ToList();
while this works just fine?
MongoCollection<BsonDocument> tempCollection = DBHelper.GetInstance().TempCollection();
IList<BsonDocument> documents = (from d in tempCollection.FindAll()
where d["Form"].AsString == id
select d).ToList();
"id" is a parameter of type string to my function where this code is.
I get the below runtime error:
System.FormatException
Input string was not in the correct format
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): mscorlib.
Exception stack trace:
at int.Parse (string,System.Globalization.NumberStyles,System.IFormatProvider) [0x00012] in /home/karim/.yaourt/yaourt-tmp-karim/aur-mono-git/src/mono/mcs/class/corlib
/System/Int32.cs:639 at int.Parse (string,System.IFormatProvider) [0x00000] in /home/karim/.yaourt/yaourt-tmp-karim/aur-mono-git/src/mono/mcs/class/corlib/System/Int32.cs:205 at System.Convert.ToInt32 (string,System.IFormatProvider) [0x00008] in /home/karim/.yaourt/yaourt-tmp-karim/aur-mono-git/src/mono/mcs/class/corlib/System/Convert.cs:1135 at string.System.IConvertible.ToInt32 (System.IFormatProvider) [0x00000] in /home/karim/.yaourt/yaourt-tmp-karim/aur-mono-git/src/mono/mcs/class/corlib/System/String.cs:2482 at System.Convert.ToInt32 (object,System.IFormatProvider) [0x00008] in /home/karim/.yaourt/yaourt-tmp-karim/aur-mono-git/src/mono/mcs/class/corlib/System/Convert.cs:1173 at System.Convert.ToInt32 (object) [0x00008] in /home/karim/.yaourt/yaourt-tmp-karim/aur-mono-git/src/mono/mcs/class/corlib/System/Convert.cs:1166 at MongoDB.Driver.Linq.Utils.BsonSerializationInfoFinder.VisitGetItem (System.Linq.Expressions.MethodCallExpression) <IL 0x00028, 0x001ab> at MongoDB.Driver.Linq.Utils.BsonSerializationInfoFinder.VisitMethodCall (System.Linq.Expressions.MethodCallExpression) <IL 0x00035, 0x00133> at MongoDB.Driver.Linq.ExpressionVisitor`1<MongoDB.Bson.Serialization.BsonSerializationInfo>.Visit (System.Linq.Expressions.Expression) <0x004e8> at MongoDB.Driver.Linq.Utils.BsonSerializationInfoFinder.Visit (System.Linq.Expressions.Expression) <IL 0x00014, 0x000af> at MongoDB.Driver.Linq.Utils.BsonSerializationInfoFinder.VisitMember (System.Linq.Expressions.MemberExpression) <IL 0x00007, 0x0008c> at MongoDB.Driver.Linq.ExpressionVisitor`1<MongoDB.Bson.Serialization.BsonSerializationInfo>.Visit (System.Linq.Expressions.Expression) <0x00467> at MongoDB.Driver.Linq.Utils.BsonSerializationInfoFinder.Visit (System.Linq.Expressions.Expression) <IL 0x00014, 0x000af> at MongoDB.Driver.Linq.Utils.BsonSerializationInfoFinder.GetSerializationInfo (System.Linq.Expressions.Expression,System.Collections.Generic.Dictionary`2<System.Linq.Expressions.Expression, MongoDB.Bson.Serialization.BsonSerializationInfo>) <IL 0x00009, 0x0009e> at MongoDB.Driver.Linq.Utils.BsonSerializationInfoHelper.GetSerializationInfo (System.Linq.Expressions.Expression) <IL 0x0000e, 0x0006f> at MongoDB.Driver.Linq.PredicateTranslator.BuildComparisonQuery (System.Linq.Expressions.Expression,System.Linq.Expressions.ExpressionType,System.Linq.Expressions.ConstantExpression) <IL 0x00140, 0x005d7> at MongoDB.Driver.Linq.PredicateTranslator.BuildComparisonQuery (System.Linq.Expressions.BinaryExpression) <IL 0x0008c, 0x003f7> at MongoDB.Driver.Linq.PredicateTranslator.BuildQuery (System.Linq.Expressions.Expression) <IL 0x000e6, 0x003eb> at MongoDB.Driver.Linq.SelectQuery.BuildQuery () <IL 0x00024, 0x000f3> at MongoDB.Driver.Linq.SelectQuery.Execute () <IL 0x0005c, 0x002bb> at MongoDB.Driver.Linq.MongoQueryProvider.Execute (System.Linq.Expressions.Expression) <IL 0x00017, 0x000b8> at MongoDB.Driver.Linq.MongoQueryable`1<MongoDB.Bson.BsonDocument>.GetEnumerator () <0x0004b> at System.Collections.Generic.List`1<MongoDB.Bson.BsonDocument>.AddEnumerable (System.Collections.Generic.IEnumerable`1<MongoDB.Bson.BsonDocument>) <0x00067> at System.Collections.Generic.List`1<MongoDB.Bson.BsonDocument>..ctor (System.Collections.Generic.IEnumerable`1<MongoDB.Bson.BsonDocument>) <0x0015f> at System.Linq.Enumerable.ToList<MongoDB.Bson.BsonDocument> (System.Collections.Generic.IEnumerable`1<MongoDB.Bson.BsonDocument>) <0x00077> at BusinessFlowManager.Controllers.FormController.Preview (string) [0x0012b] in /home/karim/MonoDevelopProjects/BusinessFlowManager/BusinessFlowManager/Controllers/SetupControllers/FormController.cs:139 at (wrapper dynamic-method) object.lambda_method (System.Runtime.CompilerServices.Closure,System.Web.Mvc.ControllerBase,object[]) <IL 0x0000e, 0x000b6> at System.Web.Mvc.ActionMethodDispatcher.Execute (System.Web.Mvc.ControllerBase,object[]) <IL 0x00008, 0x00054> at System.Web.Mvc.ReflectedActionDescriptor.Execute (System.Web.Mvc.ControllerContext,System.Collections.Generic.IDictionary`2<string, object>) <IL 0x0007a, 0x003af> at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod (System.Web.Mvc.ControllerContext,System.Web.Mvc.ActionDescriptor,System.Collections.Generic.IDictionary`2<string, object>) <IL 0x00003, 0x00067> at System.Web.Mvc.ControllerActionInvoker/<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12 () <IL 0x0002d, 0x000d0> at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter (System.Web.Mvc.IActionFilter,System.Web.Mvc.ActionExecutingContext,System.Func`1<System.Web.Mvc.ActionExecutedContext>) <IL 0x00031, 0x001ca>
Any explanation or assistance is appreciated.
Thanks
EDIT:
I've modified the code to use Find method along with a MongoQuery instead of using the AsQueryable extension. Essentially takes care of things.
MongoCollection<BsonDocument> tempCollection = DBHelper.GetInstance().TempCollection();
IList<BsonDocument> documents = tempCollection.Find(Query.EQ("Form",id)).ToList();
What I want to do is s simple screen showing multiple items in a Grid. This can on android easily be archived using a GridView.
In MvvmCross I guess I have to use MvxGridView to archive the same.
Here is my axml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Mvx.MvxGridView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
local:MvxBind="ItemsSource Items"
local:MvxItemTemplate="#layout/itemview" />
</LinearLayout>
The itemview:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px">
<TextView
android:text="Text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView1"
local:MvxBind="Text Name" />
</LinearLayout>
My ViewModel:
using System.Collections.ObjectModel;
using Cirrious.MvvmCross.ViewModels;
namespace GridViewBug.Core.ViewModels
{
public class FirstViewModel
: MvxViewModel
{
public FirstViewModel()
{
Items = new ObservableCollection<TestClass>();
Items.Add(new TestClass { Name = "Test1" });
Items.Add(new TestClass { Name = "Test2" });
}
private string _hello = "Hello MvvmCross";
public string Hello
{
get { return _hello; }
set { _hello = value; RaisePropertyChanged(() => Hello); }
}
public ObservableCollection<TestClass> Items { get; set; }
}
public class TestClass
{
public string Name { get; set; }
}
}
And here what happens when I run this example:
05-03 16:18:32.799 I/MvxBind ( 7960): 0.84 Problem seen during binding execution for from Items to ItemsSource - problem TargetInvocationException: Exception has been thrown by the target of an invocation.
05-03 16:18:32.799 I/MvxBind ( 7960): at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.SetValue (System.Object value) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (Boolean isAvailable, System.Object value) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): InnerException was UnsupportedOperationException: Exception of type 'Java.Lang.UnsupportedOperationException' was thrown.
05-03 16:18:32.799 I/MvxBind ( 7960): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod) [0x00023] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:604
05-03 16:18:32.799 I/MvxBind ( 7960): at Android.Views.ViewGroup.RemoveAllViews () [0x00053] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.Views.ViewGroup.cs:2582
05-03 16:18:32.799 I/MvxBind ( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxViewGroupExtensions.Refill (Android.Views.ViewGroup viewGroup, IAdapter adapter) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxViewGroupExtensions.UpdateDataSetFromChange[MvxGridView] (Cirrious.MvvmCross.Binding.Droid.Views.MvxGridView viewGroup, System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs eventArgs) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxGridView.AdapterOnDataSetChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs eventArgs) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at (wrapper delegate-invoke) <Module>:invoke_void__this___object_NotifyCollectionChangedEventArgs (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
05-03 16:18:32.799 I/MvxBind ( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapterWithChangedEvent.NotifyDataSetChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapterWithChangedEvent.NotifyDataSetChanged () [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapter.SetItemsSource (IEnumerable value) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapter.set_ItemsSource (IEnumerable value) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxGridView.set_ItemsSource (IEnumerable value) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
05-03 16:18:32.799 I/MvxBind ( 7960): at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/MvxBind ( 7960): --- End of managed exception stack trace ---
05-03 16:18:32.799 I/MvxBind ( 7960): java.lang.UnsupportedOperationException: removeAllViews() is not supported in AdapterView
05-03 16:18:32.799 I/MvxBind ( 7960): at android.widget.AdapterView.removeAllViews(AdapterView.java:521)
05-03 16:18:32.799 I/MvxBind ( 7960): at cirrious.mvvmcross.binding.droid.binders.MvxBindingLayoutInflatorFactory.n_onCreateView(Native Method)
05-03 16:18:32.799 I/MvxBind ( 7960): at cirrious.mvvmcross.binding.droid.binders.MvxBindingLayoutInflatorFactory.onCreateView(MvxBindingLayoutInflatorFactory.java:29)
05-03 16:18:32.799 I/MvxBind ( 7960): at android.view.LayoutInflater.createViewFromTag(Layo
05-03 16:18:32.799 I/mono-stdout( 7960): MvxBind:Error: 0.84 Problem seen during binding execution for from Items to ItemsSource - problem TargetInvocationException: Exception has been thrown by the target of an invocation.
05-03 16:18:32.799 I/mono-stdout( 7960): at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/mono-stdout( 7960): at System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/mono-stdout( 7960): at System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) [0x00000] in <filename unknown>:0
05-03 16:18:32.799 I/mono-stdout( 7960): at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.SetValue (System.Object value) [0x00000] in <filename unknown>:0
05-03 16:18:32.809 I/mono-stdout( 7960): at Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (Boolean isAvailable, System.Object value) [0x00000] in <filename unknown>:0
05-03 16:18:32.809 I/mono-stdout( 7960): InnerException was UnsupportedOperationException: Exception of type 'Java.Lang.UnsupportedOperationException' was thrown.
05-03 16:18:32.809 I/mono-stdout( 7960): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod) [0x00023] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:604
05-03 16:18:32.809 I/mono-stdout( 7960): at Android.Views.ViewGroup.RemoveAllViews () [0x00053] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.Views.ViewGroup.cs:2582
05-03 16:18:32.809 I/mono-stdout( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxViewGroupExtensions.Refill (Android.Views.ViewGroup viewGroup, IAdapter adapter) [0x00000] in <filename unknown>:0
05-03 16:18:32.809 I/mono-stdout( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxViewGroupExtensions.UpdateDataSetFromChange[MvxGridView] (Cirrious.MvvmCross.Binding.Droid.Views.MvxGridView viewGroup, System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs eventArgs) [0x00000] in <filename unknown>:0
05-03 16:18:32.809 I/mono-stdout( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxGridView.AdapterOnDataSetChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs eventArgs) [0x00000] in <filename unknown>:0
05-03 16:18:32.809 I/mono-stdout( 7960): at (wrapper delegate-invoke) <Module>:invoke_void__this___object_NotifyCollectionChangedEventArgs (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
05-03 16:18:32.809 I/mono-stdout( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapterWithChangedEvent.NotifyDataSetChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <filename unknown>:0
05-03 16:18:32.809 I/mono-stdout( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapterWithChangedEvent.NotifyDataSetChanged () [0x00000] in <filename unknown>:0
05-03 16:18:32.809 I/mono-stdout( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapter.SetItemsSource (IEnumerable value) [0x00000] in <filename unknown>:0
05-03 16:18:32.809 I/mono-stdout( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapter.set_ItemsSource (IEnumerable value) [0x00000] in <filename unknown>:0
05-03 16:18:32.809 I/mono-stdout( 7960): at Cirrious.MvvmCross.Binding.Droid.Views.MvxGridView.set_ItemsSource (IEnumerable value) [0x00000] in <filename unknown>:0
05-03 16:18:32.809 I/mono-stdout( 7960): at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
05-03 16:18:32.809 I/mono-stdout( 7960): at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
05-03 16:18:32.809 I/mono-stdout( 7960): --- End of managed exception stack trace ---
05-03 16:18:32.809 I/mono-stdout( 7960): java.lang.UnsupportedOperationException: removeAllViews() is not supported in AdapterView
05-03 16:18:32.809 I/mono-stdout( 7960): at android.widget.AdapterView.removeAllViews(AdapterView.java:521)
05-03 16:18:32.809 I/mono-stdout( 7960): at cirrious.mvvmcross.binding.droid.binders.MvxBindingLayoutInflatorFactory.n_onCreateView(Native Method)
05-03 16:18:32.809 I/mono-stdout( 7960): at cirrious.mvvmcross.binding.droid.binders.MvxBindingLayoutInflatorFactory.onCreateView(MvxBindingLayoutInflatorFactory.java:29)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
05-03 16:18:32.809 I/mono-stdout( 7960): at gridviewbug.droid.views.FirstView.n_onCreate(Native Method)
05-03 16:18:32.809 I/mono-stdout( 7960): at gridviewbug.droid.views.FirstView.onCreate(FirstView.java:28)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.app.Activity.performCreate(Activity.java:4465)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.os.Handler.dispatchMessage(Handler.java:99)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.os.Looper.loop(Looper.java:137)
05-03 16:18:32.809 I/mono-stdout( 7960): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-03 16:18:32.809 I/mono-stdout( 7960): at java.lang.reflect.Method.invokeNative(Native Method)
05-03 16:18:32.809 I/mono-stdout( 7960): at java.lang.reflect.Method.invoke(Method.java:511)
05-03 16:18:32.809 I/mono-stdout( 7960): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-03 16:18:32.809 I/mono-stdout( 7960): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-03 16:18:32.809 I/mono-stdout( 7960): at dalvik.system.NativeStart.main(Native Method)
What I'm doing wrong?
I'm using the latest stuff I can get from Nuget. Running on Mono Android 4.6.4 in VS2012
Here is the repo with the complete code:
https://github.com/sschoeb/MvvmCrossGridViewProblem
From the tracem it looks like a straight-forward bug, probably a regression that occured somewhere while fixing another issue.
Your best bet would be to open an issue for this on GitHub - https://github.com/slodge/MvvmCross/issues/new? Or you could fork the source and fix it in your branch.
In the meantime, maybe try using the MvxListView? Or create a new bindable ViewGroup?