Adding public string to RealmObject causes crash


#1

Good afternoon,
I have an Xamarin app using platform native UI and MvvmCross, and I’ve been experiencing a rather strange error when attempting to add a new realm object.

public class CacheBasicItem : RealmObject

{
// When the object was first added to the cache
public DateTimeOffset CacheDate { get; set; }
// Object number in cache
public RealmInteger Counter { get; set; }
}

Works fine, no problem, now, upon adding any string it immediately crashes my iOS app on startup with

Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Application windows are
expected to have a root view controller at the end of application launch

So, lets say I want to add name: public string Name {get; set;} <------ boom crash. Comment it out, no problem at all. I’ve run out of troubleshooting ideas, hopefully someone has encountered this before.

EDIT: So I found that if I remove the setter, it no longer crashes, which still doesn’t make sense to me
public string Name {get; set;} insta-crash
public string Name {get;} no crash

But I thought Realm fully supported strings for .Net?


#2

The exception you’ve posted doesn’t appear to be related to Realm at all. It indicates that you have not specified a root view controller for your app. You can check the discussion on the Xamarin Forums.


#3

Yes I understand that, but what I’m saying is the exception is only ever thrown when a public string with a setter is added to a RealmObject, I’m just curious on what the probable cause could be.


#4

Do you have a migration?