Exception thrown when pinning a pane after unpinning it when one Pane Visibility is Collapsed

3 posts, 1 answers
  1. Rick Glos
    Rick Glos avatar
    70 posts
    Member since:
    Mar 2009

    Posted 15 Aug 2011 Link to this post

    Hello,

    I have created a simple WPF app to demonstrate a bug we are seeing.

    In our application, we have a RadPane that only certain users should be able to see because of Permissions.  We are attempting to do this using the Visibility property on the RadPane.

    If I create a RadDocking control with a RadPaneGroup and set one of the RadPane elements Visibility property to Collapsed.  It does two things.

    1. It shows up when I unpin the Visible RadPane (note that if you unpin the Service Card Explorer, you suddenly see the Operations Explorer)
    2. If you try and repin the Pane, a Cannot call Arrange on a UIElement with infinite size or NaN. exception is thrown.

    XAML

    <Window x:Class="RadDockingPaneVisibilityBug.MainWindow"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <telerik:RadDocking Grid.Row="1">
                <telerik:RadDocking.DocumentHost>
                    <telerik:RadSplitContainer>
                        <telerik:RadPaneGroup>
                            <telerik:RadDocumentPane Header="Content" Visibility="Collapsed" CanUserClose="False">
                                <TextBlock Text="Content" />
                            </telerik:RadDocumentPane>
                        </telerik:RadPaneGroup>
                    </telerik:RadSplitContainer>
                </telerik:RadDocking.DocumentHost>
                <telerik:RadSplitContainer>
                    <telerik:RadPaneGroup>
                        <telerik:RadPane Header="Service Card Explorer" CanUserClose="False">
                            <TextBlock Text="Service Card Explorer" />
                        </telerik:RadPane>
                        <telerik:RadPane Header="Operations Explorer" CanUserClose="False" Visibility="Collapsed">
                            <TextBlock Text="Operations Explorer" />
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking>
        </Grid>
    </Window>


    Steps to reproduce:

    1. Launch the application
    2. Unpin the 'Service Card Explorer' pane - note we suddenly see the Operations Explorer pane - this should not be
    3. Unpin the 'Operations Explorer' pane
    4. Try and pin the 'Service Card Explorer' pane - note the exception

    Exception:

    System.InvalidOperationException was unhandled
      Message=Cannot call Arrange on a UIElement with infinite size or NaN. Parent of type 'Telerik.Windows.Controls.Primitives.TabStripPanel' invokes the UIElement. Arrange called on element of type 'Telerik.Windows.Controls.RadPane'.
      Source=PresentationCore
      StackTrace:
           at System.Windows.UIElement.Arrange(Rect finalRect)
           at Telerik.Windows.Controls.Primitives.TabStripPanel.ArrangeOverride(Size finalSize)
           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.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.DockPanel.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.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.Grid.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.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.InvokeOnRenderCallback.DoWork()
           at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
           at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
           at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
           at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
           at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.DispatcherOperation.InvokeImpl()
           at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
           at System.Threading.ExecutionContext.runTryCode(Object userData)
           at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Windows.Threading.DispatcherOperation.Invoke()
           at System.Windows.Threading.Dispatcher.ProcessQueue()
           at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
           at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
           at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
           at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
           at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
           at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
           at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
           at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
           at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
           at System.Windows.Threading.Dispatcher.Run()
           at System.Windows.Application.RunDispatcher(Object ignore)
           at System.Windows.Application.RunInternal(Window window)
           at System.Windows.Application.Run(Window window)
           at System.Windows.Application.Run()
           at RadDockingPaneVisibilityBug.App.Main() in C:\Data\Source\Work\2\Jerrys\ServiceCard\Main\Sandbox\RadDockingPaneVisibilityBug\RadDockingPaneVisibilityBug\obj\x86\Debug\App.g.cs:line 0
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:

  2. Answer
    Pana
    Admin
    Pana avatar
    748 posts

    Posted 19 Aug 2011 Link to this post

    Hello,

    The Visibility property of the RadPane works only for the tabbish visual in the RadPaneGroup. It is not supposed to set the content to hidden also.

    For your scenario please use the IsHidden property of the RadPane and set it to False instead of setting the Visibility to Collapsed.

    Regards,
    Pana
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Rick Glos
    Rick Glos avatar
    70 posts
    Member since:
    Mar 2009

    Posted 23 Aug 2011 Link to this post

    Thanks that fixed it.
Back to Top