Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm having a UI problem in running vs. debugging a Silverlight project. See the code below:
C#
var tree = GetEverySecond(() => sl.Get<Tree>(), 15);

if (tree == null)
    Assert.Fail("Could not find tree");
tree.Nodes[0].Select();

foreach (var Node in tree.Nodes)
{
    var firstCategoryNode = Node;
    foreach (var subNode in firstCategoryNode.Nodes)
    {
        if (subNode.Text == "Variabelen")
            subNode.Select();
    }
}
if (tree.SelectedNode.Text!="Variabelen")
    //Assert.Fail("Could not find variables node in tree");
    throw new NullReferenceException("Could not find variables node in tree");

In other words, walk through the nodes of a tree and look for a sub-node called "Variabelen"

This works fine when I do "Run unit tests"; the node is found, selected, and no exception is thrown.

When I do "Debug unit tests" and put a breakpoint on "subNode.Select();", the breakpoint is hit, but the node apparently isn't selected. If I continue to run from there, the exception is thrown, and the inspector says I still have the first root node selected.

Anyone any ideas?

Thanks!

Jur.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900