Giter Club home page Giter Club logo

Comments (3)

Dijji avatar Dijji commented on May 29, 2024

I'm seeing the same. I'll take a look and get back to you shortly.

Dijji

from xstreader.

Dijji avatar Dijji commented on May 29, 2024

The bug is quite subtle. XstFile.cs contains:

 public void ReadMessages(Folder f)
 {
    if (f.ContentCount > 0)
    {
        using (var fs = ndb.GetReadStream())
        {
            // Get the Contents table for the folder
            var ms = ltp.ReadTable<Message>(fs, NID.TypedNID(EnidType.CONTENTS_TABLE, f.Nid),
                  ndb.IsUnicode4K ? pgMessageList4K : pgMessageList, (m, id) => m.Nid = new NID(id));

            if (ndb.IsUnicode4K)
            { 
                foreach (var m in ms)
                    ltp.ReadProperties<Message>(fs, m.Nid, pgMessageDetail4K, m);
            }

            // We may be called on a background thread, so we need to dispatch this to the UI thread
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                f.Messages.Clear();
                foreach (var m in ms)
                {
                    f.AddMessage(m);
                }
            }));
        }
    }
 }

ms is a query, so the first foreach, conditional on it being a 4K file, executes the query and adds the name properties, which are missing from the contents table.

However, at the time of the second foreach, used to populate the messages in the view, ms is still a query, so it executes it again and adds Messages to the view, this time without the name properties.

A simple fix is to execute the query only once, and make ms a concrete set of objects, for instance by saying:

var ms = ltp.ReadTable<Message>(fs, NID.TypedNID(EnidType.CONTENTS_TABLE, f.Nid),
      ndb.IsUnicode4K ? pgMessageList4K : pgMessageList, (m, id) => m.Nid = new NID(id)).ToArray();

I will submit a change in response to this issue.

Dijji

from xstreader.

Dijji avatar Dijji commented on May 29, 2024

Fixed in Version 1.3

from xstreader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.