Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when expanding tree node #169

Closed
HEskandari opened this issue Oct 30, 2013 · 5 comments
Closed

Exception when expanding tree node #169

HEskandari opened this issue Oct 30, 2013 · 5 comments

Comments

@HEskandari
Copy link
Contributor

Any reason I'm getting this exception when expanding a tree node (WPF app)? I do have reference to the "TreeNode" object and will get a NRE when executing Expand method on it. I'm using version 0.11.0.207.

System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=TestStack.White
StackTrace:
at TestStack.White.UIItems.TreeItems.WPFTreeNode.DoExpand() in c:\TeamCity\buildAgent\work\77ff376102fcfa6f\src\TestStack.White\UIItems\TreeItems\WPFTreeNode.cs:line 26
at TestStack.White.UIItems.TreeItems.TreeNode.Expand() in c:\TeamCity\buildAgent\work\77ff376102fcfa6f\src\TestStack.White\UIItems\TreeItems\TreeNode.cs:line 83
at TestStack.White.Bricks.DelegateInvoker.VoidActionInvokerWrapper.Call(Object[] args) in c:\TeamCity\buildAgent\work\77ff376102fcfa6f\src\TestStack.White\Bricks\DelegateInvoker.cs:line 309
at TestStack.White.Bricks.DynamicProxyInterceptors.Process(IInvocation invocation, CoreInterceptContext interceptedContext) in c:\TeamCity\buildAgent\work\77ff376102fcfa6f\src\TestStack.White\Bricks\DynamicProxyInterceptors.cs:line 21
at TestStack.White.Interceptors.CoreInterceptor.Intercept(IInvocation invocation) in c:\TeamCity\buildAgent\work\77ff376102fcfa6f\src\TestStack.White\Interceptors\CoreInterceptor.cs:line 31
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.WPFTreeNodeProxy.Expand()
at NServiceBus.Profiler.FunctionalTests.Parts.LayoutManager.ActivateQueueExplorer() in c:\Projects\NSBProfiler\NServiceBus.Profiler.FunctionalTests\Parts\LayoutManager.cs:line 50

@HEskandari
Copy link
Contributor Author

Also tried casting it to WPFTreeNode and execute Click on it, I get another NRE, different call stack:

at TestStack.White.UIItems.TreeItems.WPFTreeNode.get_SelectPoint() in c:\TeamCity\buildAgent\work\77ff376102fcfa6f\src\TestStack.White\UIItems\TreeItems\WPFTreeNode.cs:line 19
at TestStack.White.UIItems.TreeItems.TreeNode.Select() in c:\TeamCity\buildAgent\work\77ff376102fcfa6f\src\TestStack.White\UIItems\TreeItems\TreeNode.cs:line 57
at TestStack.White.UIItems.TreeItems.TreeNode.Click() in c:\TeamCity\buildAgent\work\77ff376102fcfa6f\src\TestStack.White\UIItems\TreeItems\TreeNode.cs:line 115
at TestStack.White.Bricks.DelegateInvoker.VoidActionInvokerWrapper.Call(Object[] args) in c:\TeamCity\buildAgent\work\77ff376102fcfa6f\src\TestStack.White\Bricks\DelegateInvoker.cs:line 309
at TestStack.White.Bricks.DynamicProxyInterceptors.Process(IInvocation invocation, CoreInterceptContext interceptedContext) in c:\TeamCity\buildAgent\work\77ff376102fcfa6f\src\TestStack.White\Bricks\DynamicProxyInterceptors.cs:line 21
at TestStack.White.Interceptors.CoreInterceptor.Intercept(IInvocation invocation) in c:\TeamCity\buildAgent\work\77ff376102fcfa6f\src\TestStack.White\Interceptors\CoreInterceptor.cs:line 31
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.WPFTreeNodeProxy.Click()
at NServiceBus.Profiler.FunctionalTests.Parts.LayoutManager.ActivateQueueExplorer()

@HEskandari
Copy link
Contributor Author

Trying different approaches and found out that using UIAutomationVerify I can invoke ExpandCollapsePattern and it does work.

@JakeGinnivan
Copy link
Member

That line is var expandCollapseButton = GetExpandCollapseButton();

Is there a custom style on this treeview and the button has been removed from the treeitem?

@JakeGinnivan
Copy link
Member

Sorry, after that line, so null is being returned from GetExpandCollapseButton()

As a workaround you can always access the automation element directly, then use the ExpandCollapsePattern

@HEskandari
Copy link
Contributor Author

@JakeGinnivan Yes, this is DevExpress tree control (custom control) and not exactly WPF tree control, but it still exposes the same control type through automation API. As a workaround I created extension methods for TreeNode that'd use ExpandCollapsePattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants