SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

[WPF] Exception when switching to designer (and including the Viewport2DVisual3D class in XAML)

Last post 04-09-2015 9:00 PM by XyLoNaMiyX. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 04-03-2015 3:11 PM

    [WPF] Exception when switching to designer (and including the Viewport2DVisual3D class in XAML)

    Hello! I was trying the next example from MSDN:
    https://msdn.microsoft.com/en-us/library/system.windows.media.media3d.viewport2dvisual3d.aspx

    <viewport3d>
        <viewport3d.camera>
    <perspectivecamera position="0, 0, 4">
        </perspectivecamera></viewport3d.camera>
        <!-- Button on 3D -->
        <viewport2dvisual3d>
            <!-- Give the plane a slight rotation -->
            <viewport2dvisual3d.transform>
                <rotatetransform3d>
                    <rotatetransform3d.rotation>
                        <axisanglerotation3d angle="40" axis="0, 1, 0">
                    </axisanglerotation3d></rotatetransform3d.rotation>
                </rotatetransform3d>
            </viewport2dvisual3d.transform>
            <!-- The Geometry, Material, and Visual for the Viewport2DVisual3D -->
            <viewport2dvisual3d.geometry>
                <meshgeometry3d positions="-1,1,0 -1,-1,0 1,-1,0 1,1,0" texturecoordinates="0,0 0,1 1,1 1,0" triangleindices="0 1 2 0 2 3">
            </meshgeometry3d></viewport2dvisual3d.geometry>
            <viewport2dvisual3d.material>
                <diffusematerial viewport2dvisual3d.isvisualhostmaterial="True" brush="White">
            </diffusematerial></viewport2dvisual3d.material>                               
            <button>Hello, 3D</button>
        </viewport2dvisual3d>
        <!-- Lights -->
        <modelvisual3d>
            <modelvisual3d.content>
                <directionallight color="#FFFFFFFF" direction="0,0,-1">
            </directionallight></modelvisual3d.content>
        </modelvisual3d>
    </viewport3d>
    

     

    But when I switched to the designer mode, an exception occured:

    SharpDevelop Version : 5.0.0.4755-c848dc28
    .NET Version         : 4.5.51641
    OS Version           : Microsoft Windows NT 6.3.9600.0
    Current culture      : Invariant Language (Invariant Country) ()
    Current UI language  : en
    Running under WOW6432, processor architecture: x86-64
    Working Set Memory   : 179108kb
    GC Heap Memory       : 71205kb
    
    Unhandled WPF exception
    Exception thrown:
    System.InvalidCastException: Unable to cast object of type 'System.Windows.Media.GeneralTransformGroup' to type 'System.Windows.Media.Transform'.
       at ICSharpCode.WpfDesign.Designer.Controls.AdornerLayer.GetPositionCache(UIElement element)
       at ICSharpCode.WpfDesign.Designer.Controls.AdornerLayer.UpdateAdornersForElement(UIElement element, AdornerInfo info, Boolean forceInvalidate)
       at ICSharpCode.WpfDesign.Designer.Controls.AdornerLayer.UpdateAllAdorners(Boolean forceInvalidate)
       at ICSharpCode.WpfDesign.Designer.Controls.AdornerLayer.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
       at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
       at System.Windows.ContextLayoutManager.UpdateLayout()
       at System.Windows.UIElement.UpdateLayout()
       at System.Windows.Controls.TabItem.OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
       at System.Windows.UIElement.OnPreviewGotKeyboardFocusThunk(Object sender, KeyboardFocusChangedEventArgs e)
       at System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
       at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
       at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
       at System.Windows.UIElement.Focus()
       at System.Windows.Controls.TabItem.SetFocus()
       at System.Windows.Controls.TabItem.OnMouseLeftButtonDown(MouseButtonEventArgs e)
       at System.Windows.UIElement.OnMouseLeftButtonDownThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(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)
    
    ---- Recent log messages:
    14:56:03.679 [21] DEBUG - Received command BuildDone
    14:56:03.694 [21] INFO - Finished building test, success=True
    14:56:03.694 [1] INFO - Debugger Command: Start (withDebugger=True)
    14:56:03.710 [1] INFO - Loading addin ILSpy AddIn
    14:56:03.710 [1] INFO - Saving layout file: C:\Users\Lonami\AppData\Roaming\ICSharpCode\SharpDevelop5\layouts\Default.xml
    14:56:03.726 [1] INFO - Loading layout file: C:\Users\Lonami\AppData\Roaming\ICSharpCode\SharpDevelop5\layouts\Debug.xml, hideAllLostPads=False
    14:56:03.804 [1] DEBUG - ChooseLayoutCommand.LayoutChanged(object,EventArgs)
    14:56:03.804 [1] DEBUG - ChooseLayoutCommand.Run()
    14:56:03.804 [1] INFO - Saving layout file: C:\Users\Lonami\AppData\Roaming\ICSharpCode\SharpDevelop5\layouts\Debug.xml
    14:56:03.835 [1] DEBUG - Service startup: ICSharpCode.SharpDevelop.Dom.ClassBrowser.IClassBrowser
    14:56:03.913 [1] DEBUG - Creating pad ICSharpCode.SharpDevelop.Gui.Pads.ConsolePad...
    14:56:04.435 [1] DEBUG - Resolved (Line 20, Col 33) to [ErrorResolveResult ?]
    14:56:05.575 [1] DEBUG - Resolved (Line 6, Col 3) to [ErrorResolveResult ?]
    14:56:08.490 [1] DEBUG - Resolved (Line 24, Col 38) to [ErrorResolveResult ?]
    14:56:13.709 [18] DEBUG - Telling worker process to exit
    14:56:13.709 [18] DEBUG - Waiting for thread-join
    14:56:13.709 [21] DEBUG - Cannot read from WorkerProcess 3844: end of stream
    14:56:13.709 [21] DEBUG - Stopped reading from WorkerProcess 3844.
    14:56:13.709 [21] DEBUG - Telling worker process to exit
    14:56:13.709 [21] DEBUG - End of reader thread on WorkerProcess 3844.
    14:56:13.709 [18] DEBUG - Joined!
    14:56:28.538 [1] DEBUG - NavigationService
    	ActiveViewContent: Window1.xaml
    	          Subview: ${res:FormsDesigner.DesignTabPages.DesignTabPage}
    14:56:28.538 [1] DEBUG - ActiveViewContentChanged to ICSharpCode.WpfDesign.AddIn.WpfViewContent
    14:56:28.788 [1] DEBUG - ActiveContentChanged to ICSharpCode.WpfDesign.AddIn.WpfViewContent
    14:56:28.882 [1] ERROR - Unhandled WPF exception
    --> Exception:
    System.InvalidCastException: Unable to cast object of type 'System.Windows.Media.GeneralTransformGroup' to type 'System.Windows.Media.Transform'.
       at ICSharpCode.WpfDesign.Designer.Controls.AdornerLayer.GetPositionCache(UIElement element)
       at ICSharpCode.WpfDesign.Designer.Controls.AdornerLayer.UpdateAdornersForElement(UIElement element, AdornerInfo info, Boolean forceInvalidate)
       at ICSharpCode.WpfDesign.Designer.Controls.AdornerLayer.UpdateAllAdorners(Boolean forceInvalidate)
       at ICSharpCode.WpfDesign.Designer.Controls.AdornerLayer.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
       at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
       at System.Windows.ContextLayoutManager.UpdateLayout()
       at System.Windows.UIElement.UpdateLayout()
       at System.Windows.Controls.TabItem.OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
       at System.Windows.UIElement.OnPreviewGotKeyboardFocusThunk(Object sender, KeyboardFocusChangedEventArgs e)
       at System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
       at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
       at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
       at System.Windows.UIElement.Focus()
       at System.Windows.Controls.TabItem.SetFocus()
       at System.Windows.Controls.TabItem.OnMouseLeftButtonDown(MouseButtonEventArgs e)
       at System.Windows.UIElement.OnMouseLeftButtonDownThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(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)
    
    ---- Post-error application state information:
    Installed 3rd party AddIns: [PInvoke Add-in 0.0.0.0], [Mono 0.0.0.0]
    ProjectService.CurrentSolution: [Solution D:\Drive\Documentos\SharpDevelop Projects\test\test.sln with 1 projects]
    ProjectService.CurrentProject: [CSharpProject: test]
    Workbench.ActiveContent: ICSharpCode.WpfDesign.AddIn.WpfViewContent
    

    The project was a new WPF project, without any other modification. Thanks in advance!

     

    ~Lonami

  • 04-09-2015 1:49 AM In reply to

    • Rpinski
    • Top 25 Contributor
    • Joined on 05-27-2012
    • Germany
    • Posts 99

    Re: [WPF] Exception when switching to designer (and including the Viewport2DVisual3D class in XAML)

    Added as issue on GitHub: https://github.com/icsharpcode/SharpDevelop/issues/675

    Regards,
    Andreas

  • 04-09-2015 4:11 PM In reply to

    Re: [WPF] Exception when switching to designer (and including the Viewport2DVisual3D class in XAML)

    Okay! Thank you!

  • 04-09-2015 8:03 PM In reply to

    Re: [WPF] Exception when switching to designer (and including the Viewport2DVisual3D class in XAML)

    Will be fixed with https://github.com/icsharpcode/SharpDevelop/pull/676

  • 04-09-2015 9:00 PM In reply to

    Re: [WPF] Exception when switching to designer (and including the Viewport2DVisual3D class in XAML)

    Thankkkks to everyone!! Nice community :)

    This post can be closed! ^^

    Regards,
     ~Lonami

Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.