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

NullReferenceException in ICSharpCode.TreeView.SharpTreeNodeView.CalculateIndent() #857

Closed
KirillOsenkov opened this Issue Sep 19, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@KirillOsenkov
Contributor

KirillOsenkov commented Sep 19, 2017

---------------------------
Sorry, we crashed
---------------------------
System.NullReferenceException: Object reference not set to an instance of an object.
   at ICSharpCode.TreeView.SharpTreeNodeView.CalculateIndent()
   at ICSharpCode.TreeView.LinesRenderer.OnRender(DrawingContext dc)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.VirtualizingStackPanel.ArrangeItemsBeyondTheExtendedViewport(Boolean isHorizontal, UIElement child, Size childDesiredSize, Double arrangeLength, IList items, IItemContainerGenerator generator, IContainItemStorage itemStorageProvider, Boolean areContainersUniformlySized, Double uniformOrAverageContainerSize, Boolean beforeExtendedViewport, Rect& rcChild, Size& previousChildSize, Point& previousChildOffset, Int32& previousChildItemIndex)
   at System.Windows.Controls.VirtualizingStackPanel.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize)
   at System.Windows.Controls.ItemsPresenter.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.ScrollContentPresenter.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds)
   at System.Windows.Controls.ScrollViewer.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Control.ArrangeOverride(Size arrangeBounds)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Grid.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.DockPanel.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at MS.Internal.Helper.ArrangeElementWithSingleChild(UIElement element, Size arrangeSize)
   at System.Windows.Controls.ContentPresenter.ArrangeOverride(Size arrangeSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Decorator.ArrangeOverride(Size arrangeSize)
   at System.Windows.Documents.AdornerDecorator.ArrangeOverride(Size finalSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Controls.Border.ArrangeOverride(Size finalSize)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.Window.ArrangeOverride(Size arrangeBounds)
   at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
   at System.Windows.UIElement.Arrange(Rect finalRect)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
---------------------------
OK   
---------------------------
@christophwille

This comment has been minimized.

Show comment
Hide comment
@christophwille

christophwille Sep 19, 2017

Member

Do you by any chance have repro steps for us?

Member

christophwille commented Sep 19, 2017

Do you by any chance have repro steps for us?

@KirillOsenkov

This comment has been minimized.

Show comment
Hide comment
@KirillOsenkov

KirillOsenkov Sep 19, 2017

Contributor

I was basically expanding the References node for an assembly and at the same time it added all the new (blue) reference assemblies to the treeview. Unfortunately I'm not sure if it's reproducible because I kept clicking around and it seemed OK. Also, ILSpy didn't crash, but just displayed a MessageBox with the stack, where I copied it from.

Contributor

KirillOsenkov commented Sep 19, 2017

I was basically expanding the References node for an assembly and at the same time it added all the new (blue) reference assemblies to the treeview. Unfortunately I'm not sure if it's reproducible because I kept clicking around and it seemed OK. Also, ILSpy didn't crash, but just displayed a MessageBox with the stack, where I copied it from.

@KirillOsenkov

This comment has been minimized.

Show comment
Hide comment
@KirillOsenkov

KirillOsenkov Sep 19, 2017

Contributor

From quick reading of the source code, the error is somewhere here:
https://github.com/icsharpcode/ILSpy/blob/master/SharpTreeView/SharpTreeNodeView.cs#L135-L151

So either the Node is null, or ParentTreeView is null. Probably need to trace the data flow through these variables to see how they could be null, and add a bunch of checks everywhere.

Contributor

KirillOsenkov commented Sep 19, 2017

From quick reading of the source code, the error is somewhere here:
https://github.com/icsharpcode/ILSpy/blob/master/SharpTreeView/SharpTreeNodeView.cs#L135-L151

So either the Node is null, or ParentTreeView is null. Probably need to trace the data flow through these variables to see how they could be null, and add a bunch of checks everywhere.

@KirillOsenkov

This comment has been minimized.

Show comment
Hide comment
@KirillOsenkov

KirillOsenkov Sep 19, 2017

Contributor

This happens during layout, so likely another thread may have mutated something while the layout was in progress, so there may be some synchronization missing somewhere.

Contributor

KirillOsenkov commented Sep 19, 2017

This happens during layout, so likely another thread may have mutated something while the layout was in progress, so there may be some synchronization missing somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment