question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to load IList<int> from Realm database on a UWP project

See original GitHub issue

Goals

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:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nirinchevcommented, Jan 4, 2021
0reactions
FoggyFindercommented, Feb 13, 2020

Some additional info:

The issue, as it was mention above, with parameter value here and here

MCVE:

    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();

            Realm.DeleteRealm(RealmConfiguration.DefaultConfiguration);
            var realm = Realm.GetInstance();
            realm.Write(() =>
            {
                realm.Add(new SomeClass
                {
                    Data = { 1, 2, 3 }
                });
            });
            lbl.Text = string.Join(",", realm.Find<SomeClass>(0).Data);
        }
    }

    public class SomeClass : RealmObject
    {
        [PrimaryKey]
        public int Id { get; set; }
        public IList<double> Data { get; }
    }

MCVE project is attached

XFAppMCVE.zip

Read more comments on GitHub >

github_iconTop Results From Across the Web

Realm 2-way binding in Xamarin Forms UWP throws ...
I have installed the Realm.Database nuget version 3.4.0, and the FodyWeavers.xml files are present in all of the projects. c# ...
Read more >
UWP Package project encountering "Could not load file or ...
When running Package project with UWP dependency, it causes "Could not load file or assembly 'System.Memory" error on XmlSerializer.
Read more >
Realm DB and windows phone 10
I want to install realm database on windows mobile phone version 10 using UWP by c#. My environment : Microsoft Visual Studio Professional...
Read more >
Integrating Realm Database in an Android Application
Sync the project's gradle files. Before you can use Realm in your app, you must initialize a Realm. Realms are the equivalent of...
Read more >
Realm.io: Realm Home
Fast and lightweight and the best. Build data rich apps without draining device resources with Realm's lazy loading and zero-copy architecture.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found