J
Jesper, Denmark
Preamble.
Back in the .net 1.0 days I was very concerned about a CLR bug that I
encountered. I had an if-then-else clause and the thread did not enter either
the true or false statements. After an upgrade to .net 1.1 (suggested by
Microsoft that recognized this erroneous behaviour) the problem were
resolved. Howver, as it was the first time ever I had expericed a
compiler/I.L. execution (whatever??) error, I lost a little confidence in the
compilation/i.l execution in .net. As a former c++ programmer I had learned
by experience that I, as the programmer, always were the origin of unexpected
behaviour - but this experience changed that - and today, a new weird thing
is happening. Please help:
foreach (ListViewItem lvi in this.listViewToDoList.Items)
{
Work wp = (Work)lvi.Tag;
lvi.ImageIndex = GetWaypointImageIndex(wp);
lvi.Checked = wp.Done;
lvi.SubItems[2].Text = wp.Modified;
}
The weird thing is that the collection only contains 2 elements!, the Count
field is equal to 2. But it runs thru the loop a third time and throws an
exception that lvi is null!?!. How is that possible?
Best regards
Jesper
Back in the .net 1.0 days I was very concerned about a CLR bug that I
encountered. I had an if-then-else clause and the thread did not enter either
the true or false statements. After an upgrade to .net 1.1 (suggested by
Microsoft that recognized this erroneous behaviour) the problem were
resolved. Howver, as it was the first time ever I had expericed a
compiler/I.L. execution (whatever??) error, I lost a little confidence in the
compilation/i.l execution in .net. As a former c++ programmer I had learned
by experience that I, as the programmer, always were the origin of unexpected
behaviour - but this experience changed that - and today, a new weird thing
is happening. Please help:
foreach (ListViewItem lvi in this.listViewToDoList.Items)
{
Work wp = (Work)lvi.Tag;
lvi.ImageIndex = GetWaypointImageIndex(wp);
lvi.Checked = wp.Done;
lvi.SubItems[2].Text = wp.Modified;
}
The weird thing is that the collection only contains 2 elements!, the Count
field is equal to 2. But it runs thru the loop a third time and throws an
exception that lvi is null!?!. How is that possible?
Best regards
Jesper