Failed to load IList<int> from Realm database on a UWP project
See original GitHub issueGoals
I m facing a issue when trying read an IList<int> from Realm while it works perfect when it is an IList<RealmObject>
Expected Results
Reading and using a simple IList<int> from realm.
Actual Results
groups = Count = Evaluation of method Realms.RealmCollectionBase`1[[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].get_Count requires calling method System.RuntimeTypeHandle.ToEETypePtr, which cannot be call…
Steps to Reproduce
Buil a release version of the project wih .Net native compile.
Code Sample
List<Document> documents = realm.All<Document>().ToList().Select(t => new Document(t)).ToList();
While Document is : public class Document : RealmObject, ILang, IEquatable<Document>, IWSData { [PrimaryKey] public int id { get; set; } public string name { get; set; } public string lang { get; set; } public string summary { get; set; } public string date { get; set; } public bool? document_dissociable { get; set; } public bool can_be_added_to_cart { get; set; } public int order_id { get; set; } [Ignored] public DocumentType type { get; set; } [JsonIgnore] public string documentType { get; set; } public string file_url { get; set; } public string checkSum { get; set; } public IList<int> medias_id { get; } public int revision { get; set; } public IList<int> groups { get; } public string index_file_path { get; set; } public IList<int> references_filter { get; } public IList<string> keywords { get; } public IList<Parent> parent { get;} public bool? is_shareable { get; set; } public string file_url_hd { get; set; } public string file_url_thumbnail { get; set; } public string checkSum_hd { get; set; } public bool is_opened { get; set; } public bool is_new { get; set; } public bool is_editable { get; set; } [Ignored] public DocumentFileType file_type { get; set; } = DocumentFileType.UNKNOWN; [JsonIgnore] public string documentFileType { get; set; }
[JsonIgnore]
public bool HasHd => file_url_hd != null;
public bool is_listed_in_library { get; set; }
public Document()
{
}
public Document(Document document)
{
this.id = document.id;
this.name = document.name;
this.lang = document.lang;
this.summary = document.summary;
this.date = document.date;
this.document_dissociable = document.document_dissociable;
this.can_be_added_to_cart = document.can_be_added_to_cart;
this.order_id = document.order_id;
this.type = document.type;
this.documentType = document.documentType;
this.file_url = document.file_url;
this.checkSum = document.checkSum;
this.medias_id = document.medias_id;
this.revision = document.revision;
this.groups = document.groups;
this.index_file_path = document.index_file_path;
this.references_filter = document.references_filter;
this.keywords = document.keywords;
this.parent = document.parent.Select(p => new Parent(p)).ToList();
this.is_shareable = document.is_shareable;
this.file_url_hd = document.file_url_hd;
this.file_url_thumbnail = document.file_url_thumbnail;
this.checkSum_hd = document.checkSum_hd;
this.is_opened = document.is_opened;
this.is_new = document.is_new;
this.is_editable = document.is_editable;
this.file_type = document.file_type;
this.documentFileType = document.documentFileType;
this.is_listed_in_library = document.is_listed_in_library;
}
}
Version of Realm and Tooling
- Realm Version : 3.2.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
This was fixed in https://github.com/realm/realm-dotnet/pull/2170.
Some additional info:
The issue, as it was mention above, with parameter
value
here and hereMCVE:
MCVE project is attached
XFAppMCVE.zip