Hi,
I'm doing a algorithm to calcule Earliest Start et Latest Start for a
Graph with Nodes and Arcs. (like a PERT diagram) . Unfortunatly, i
receive a wierd exception message for a specific generic (LIST<T>)
This method is calculed often before is put in a foreach statement. At
the first iterration, all is ok. But at the seond, I receive "Cannot
evaluate expression because the code of the current method is
optimized."
His someone can help me ? Here's my code.
Steeve
public void SetEarliestStart()
{
foreach (Node n in _NodeList)
{
n.Visited = false;
n.EarliestStart = 0;
n.Max = 0;
}
//Start Node
_NodeList[0].Visited = true;
_NodeList[0].EarliestStart = 0;
bool AllPrecVisited;
while(_NodeList[_NodeList.Count-1].Visited != true)
{
List<NodeNoneVisitedNodes = new List<Node>();
NoneVisitedNodes = _NodeList.FindAll(delegate(Node
node) //Exception is throw here !!
{
return node.Visited == false;
});
foreach(Node n in NoneVisitedNodes)
{
AllPrecVisited =
n.NodePrecList.TrueForAll(delegate(Node node)
{
return node.Visited == true;
});
if (AllPrecVisited)
{
foreach (Arc a in n.ArcPrecList)
{
if (n.Max < a.NodeStart.EarliestStart +
a.MoveTime
+
a.WorkTime)
{
n.Max = a.NodeStart.EarliestStart +
a.MoveTime + a.WorkTime;
}
}
n.EarliestStart = n.Max;
n.Visited = true;
break;
}
}
}
}