{"action":"closed","issue":{"url":"https://api.github.com/repos/realm/realm-dotnet/issues/684","repository_url":"https://api.github.com/repos/realm/realm-dotnet","labels_url":"https://api.github.com/repos/realm/realm-dotnet/issues/684/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-dotnet/issues/684/comments","events_url":"https://api.github.com/repos/realm/realm-dotnet/issues/684/events","html_url":"https://github.com/realm/realm-dotnet/issues/684","id":164728989,"number":684,"title":"Crash when querying Realm database (Realms.NativeResults.get_row)","user":{"login":"heiser","id":1901084,"avatar_url":"https://avatars.githubusercontent.com/u/1901084?v=3","gravatar_id":"","url":"https://api.github.com/users/heiser","html_url":"https://github.com/heiser","followers_url":"https://api.github.com/users/heiser/followers","following_url":"https://api.github.com/users/heiser/following{/other_user}","gists_url":"https://api.github.com/users/heiser/gists{/gist_id}","starred_url":"https://api.github.com/users/heiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heiser/subscriptions","organizations_url":"https://api.github.com/users/heiser/orgs","repos_url":"https://api.github.com/users/heiser/repos","events_url":"https://api.github.com/users/heiser/events{/privacy}","received_events_url":"https://api.github.com/users/heiser/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-dotnet/labels/S:In%20Progress","name":"S:In Progress","color":"ededed"},{"url":"https://api.github.com/repos/realm/realm-dotnet/labels/T:Bug-Crash","name":"T:Bug-Crash","color":"e11d21"},{"url":"https://api.github.com/repos/realm/realm-dotnet/labels/T:Help","name":"T:Help","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"AndyDentFree","id":1586093,"avatar_url":"https://avatars.githubusercontent.com/u/1586093?v=3","gravatar_id":"","url":"https://api.github.com/users/AndyDentFree","html_url":"https://github.com/AndyDentFree","followers_url":"https://api.github.com/users/AndyDentFree/followers","following_url":"https://api.github.com/users/AndyDentFree/following{/other_user}","gists_url":"https://api.github.com/users/AndyDentFree/gists{/gist_id}","starred_url":"https://api.github.com/users/AndyDentFree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndyDentFree/subscriptions","organizations_url":"https://api.github.com/users/AndyDentFree/orgs","repos_url":"https://api.github.com/users/AndyDentFree/repos","events_url":"https://api.github.com/users/AndyDentFree/events{/privacy}","received_events_url":"https://api.github.com/users/AndyDentFree/received_events","type":"User","site_admin":false},"assignees":[{"login":"AndyDentFree","id":1586093,"avatar_url":"https://avatars.githubusercontent.com/u/1586093?v=3","gravatar_id":"","url":"https://api.github.com/users/AndyDentFree","html_url":"https://github.com/AndyDentFree","followers_url":"https://api.github.com/users/AndyDentFree/followers","following_url":"https://api.github.com/users/AndyDentFree/following{/other_user}","gists_url":"https://api.github.com/users/AndyDentFree/gists{/gist_id}","starred_url":"https://api.github.com/users/AndyDentFree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndyDentFree/subscriptions","organizations_url":"https://api.github.com/users/AndyDentFree/orgs","repos_url":"https://api.github.com/users/AndyDentFree/repos","events_url":"https://api.github.com/users/AndyDentFree/events{/privacy}","received_events_url":"https://api.github.com/users/AndyDentFree/received_events","type":"User","site_admin":false}],"milestone":null,"comments":10,"created_at":"2016-07-10T18:59:53Z","updated_at":"2016-07-12T16:03:49Z","closed_at":"2016-07-12T16:03:49Z","body":"I've been able to successfully integrate Realm into a previous Xamarin app, but have hit a problem with my current project using much of the same code. When attempting to query information from the database, the application crashes and I receive:\r\n\r\n```\r\n07-10 11:13:10.976 D/Mono    (14165): Searching for 'results_create_for_query_sorted'.\r\n07-10 11:13:10.976 D/Mono    (14165): Probing 'results_create_for_query_sorted'.\r\n07-10 11:13:10.976 D/Mono    (14165): Found as 'results_create_for_query_sorted'.\r\n07-10 11:13:10.986 E/mono-rt (14165): Stacktrace:\r\n07-10 11:13:10.986 E/mono-rt (14165): \r\n07-10 11:13:10.986 E/mono-rt (14165):   at <unknown> <0xffffffff>\r\n07-10 11:13:10.986 E/mono-rt (14165):   at (wrapper managed-to-native) Realms.NativeResults.get_row (Realms.ResultsHandle,intptr) <0x0003b>\r\n07-10 11:13:10.986 E/mono-rt (14165):   at Realms.RealmResultsEnumerator`1<T_REF>.MoveNext () <IL 0x0002d, 0x00143>\r\n07-10 11:13:10.986 E/mono-rt (14165):   at System.Linq.Buffer`1<TElement_REF>..ctor (System.Collections.Generic.IEnumerable`1<TElement_REF>) [0x00083] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/System.Core/System/Linq/Enumerable.cs:2568\r\n07-10 11:13:10.986 E/mono-rt (14165):   at System.Linq.Enumerable.ToArray<TSource_REF> (System.Collections.Generic.IEnumerable`1<TSource_REF>) [0x00011] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/System.Core/System/Linq/Enumerable.cs:830\r\n```\r\n\r\nThis crash is caused from the execution of the ToArray line:\r\n\r\n```\r\nvar realm = Realm.GetInstance();\r\nvar list = realm.All<SampleListItem>().Where(d => d.Id > 0).OrderByDescending(d => d.Id);\r\nreturn list.ToArray();\r\n```\r\n\r\nI've also tried ToList, and querying the RealmResult.\r\n\r\nThis occurs when data has not yet been saved to the database, and also after saving a record with the following code (which executes successfully):\r\n\r\n```\r\n_realm.Write(() =>\r\n{\r\n    var item = _realm.CreateObject<SampleListItem>();\r\n    item.Description = description;\r\n});\r\n\r\n```\r\n\r\nSampleListItem is derived from RealmObject, has a default constructor, etc. \r\n\r\nXamarin Realm version is 0.76.1\r\nMicrosoft Visual Studio Professional 2015\r\nMicrosoft .NET Framework Version 4.6.01038\r\nXamarin   4.1.0.530 \r\nXamarin.Android   6.1.0.71\r\nXamarin.iOS   9.8.0.323"}}
{"actor":{"display_login":"AndyDentFree"}}