Minor problems loading data from SQLServer database

Dec 11, 2012 at 2:47 PM

Just thought I'd mention this in case others have a similar problem ...

When loading from a database, it can occur that no rows are returned, in which case the line in TimelineEvent.cs which reads

if (m_list.Count > 0) 

(part of the Initialize routine in the TimelineEventStore class) raises an exception. The routine has a Debug.Assert(events != null) at the start, but this doesn't help in the real runtime world! I have fixed this for my case by changing the line to

if (m_list.Any() && m_list.Count > 0)

I've also had to do this in TimelineBuilder.cs

if (AllEvents.Any() && AllEvents.Count > 0)

and TimelineTray.cs

if ((m_bands.Any()) && (m_bands.Count > 0) && (m_mainBand != null))

all for similar reasons related to retrieving 0 rows from the database under certain circumstances.


Dec 11, 2012 at 5:42 PM

This area (db access, etc) still outside of the control, while many asking for examples on how to populate data from db, I do not have it. Still, in general, m_list should never be null, while for sure it can be empty. Having it null may indicate that there is a bug/flaw in control itself or the code you build around it.