This exception is thrown in SharpDevelop 4.3, but after inspecting the relevant code, I think that version 5.1 will exhibit the same behavior. In fact I believe that this bug report: http://community.sharpdevelop.net/forums/p/22310/56847.aspx#56847 is a result of the same issue.
To replicate the issue:
1. In the WPF Designer, drag in a container control such as Grid or Canvas.
2. Drag in a control into the added container control.
3. Drag another control to the Designer but do not place it inside the container added in step 1.
4. Select the two controls from steps 2 and 3 (without selecting the container control).
5. Press Ctrl X.
I have not debugged the code, but after inspecting the relevant sections, I am convinced that the reason for this is in the PlacementOperation class. The exception is thrown in Start function. The function first creates a PlacementOperation object and then throws an exception if its currentContainerBehavior is null. Since the two selected items do not have the same parent, no currentContainerBehavior is created for them, causing this exception.
For some reason, a conscious choice was made to not enable deletion of multiple items that do not share the same parent (a very odd and annoying choice). You can see that trying to perform Delete instead of Cut in the scenario described above, results in nothing happening (since CanDeleteComponents fails when PlacementOperation.GetPlacementBehavior returns null) but at least it doesn't throw an exception.
My suggestion is to enable multiple deletion of controls that do not share the same parent, since this is a reasonable functionality to expect from a designer.
Thank you for your time, sorry for being long winded.
I've added the error report below for reference:
SharpDevelop Version : 4.3.2.9486-7f94fdf3
.NET Version : 4.0.30319.42000
OS Version : Microsoft Windows NT 6.1.7601 Service Pack 1
Current culture : Invariant Language (Invariant Country) ()
Current UI language : en
Running under WOW6432, processor architecture: x86-64
Working Set Memory : 258588kb
GC Heap Memory : 128604kb
Unhandled WPF exception
Exception thrown:
System.InvalidOperationException: Starting the operation is not supported
at ICSharpCode.WpfDesign.PlacementOperation.Start(ICollection`1 placedItems, PlacementType type) in D:\Downloads\WPF\SharpDevelop\src\AddIns\DisplayBindings\WpfDesign\WpfDesign\Project\PlacementOperation.cs:line 174
at ICSharpCode.WpfDesign.Designer.ModelTools.DeleteComponents(ICollection`1 items) in D:\Downloads\WPF\SharpDevelop\src\AddIns\DisplayBindings\WpfDesign\WpfDesign.Designer\Project\ModelTools.cs:line 81
at ICSharpCode.WpfDesign.Designer.Xaml.XamlEditOperations.Cut(ICollection`1 designItems) in D:\Downloads\WPF\SharpDevelop\src\AddIns\DisplayBindings\WpfDesign\WpfDesign.Designer\Project\Xaml\XamlEditOperations.cs:line 58
at ICSharpCode.WpfDesign.Designer.DesignSurface.Cut() in D:\Downloads\WPF\SharpDevelop\src\AddIns\DisplayBindings\WpfDesign\WpfDesign.Designer\Project\DesignSurface.xaml.cs:line 195
at ICSharpCode.WpfDesign.Designer.ExtensionMethods.<>c__DisplayClass6.<AddCommandHandler>b__4(Object sender, ExecutedRoutedEventArgs e) in D:\Downloads\WPF\SharpDevelop\src\AddIns\DisplayBindings\WpfDesign\WpfDesign.Designer\Project\ExtensionMethods.cs:line 65
at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
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.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Input.CommandManager.TranslateInput(IInputElement targetElement, InputEventArgs inputEventArgs)
at System.Windows.UIElement.OnKeyDownThunk(Object sender, KeyEventArgs e)
at System.Windows.Input.KeyEventArgs.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.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
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)
---- Recent log messages:
14:04:17.536 [1] DEBUG - ParseInformationUpdated C:\Users\Orr\Documents\SharpDevelop Projects\TestWpfApp\TestWpfApp\Window1.xaml new!=null:True
14:04:17.569 [16] DEBUG - "normal parse" took 0 ms
14:04:17.570 [16] DEBUG - Removing part C:\Users\Orr\Documents\SharpDevelop Projects\TestWpfApp\TestWpfApp\Window1.xaml from compound class TestWpfApp.Window1
14:04:17.570 [16] DEBUG - Second-to-last part removed (old part count = 2), overwriting compound with last part
14:04:17.570 [16] DEBUG - Adding existing class Window1 from Window1.xaml
14:04:17.570 [16] DEBUG - Creating compound for TestWpfApp.Window1
14:04:17.574 [1] DEBUG - ParseInformationUpdated C:\Users\Orr\Documents\SharpDevelop Projects\TestWpfApp\TestWpfApp\Window1.xaml new!=null:True
14:04:19.077 [7] DEBUG - "normal parse" took 0 ms
14:04:19.078 [7] DEBUG - Removing part C:\Users\Orr\Documents\SharpDevelop Projects\TestWpfApp\TestWpfApp\Window1.xaml from compound class TestWpfApp.Window1
14:04:19.079 [7] DEBUG - Second-to-last part removed (old part count = 2), overwriting compound with last part
14:04:19.079 [7] DEBUG - Adding existing class Window1 from Window1.xaml
14:04:19.079 [7] DEBUG - Creating compound for TestWpfApp.Window1
14:04:19.082 [1] DEBUG - ParseInformationUpdated C:\Users\Orr\Documents\SharpDevelop Projects\TestWpfApp\TestWpfApp\Window1.xaml new!=null:True
14:04:20.590 [15] DEBUG - "normal parse" took 0 ms
14:04:20.590 [15] DEBUG - Removing part C:\Users\Orr\Documents\SharpDevelop Projects\TestWpfApp\TestWpfApp\Window1.xaml from compound class TestWpfApp.Window1
14:04:20.591 [15] DEBUG - Second-to-last part removed (old part count = 2), overwriting compound with last part
14:04:20.591 [15] DEBUG - Adding existing class Window1 from Window1.xaml
14:04:20.591 [15] DEBUG - Creating compound for TestWpfApp.Window1
14:04:20.594 [1] DEBUG - ParseInformationUpdated C:\Users\Orr\Documents\SharpDevelop Projects\TestWpfApp\TestWpfApp\Window1.xaml new!=null:True
14:04:22.109 [7] DEBUG - "normal parse" took 0 ms
14:04:22.110 [7] DEBUG - Removing part C:\Users\Orr\Documents\SharpDevelop Projects\TestWpfApp\TestWpfApp\Window1.xaml from compound class TestWpfApp.Window1
14:04:22.110 [7] DEBUG - Second-to-last part removed (old part count = 2), overwriting compound with last part
14:04:22.111 [7] DEBUG - Adding existing class Window1 from Window1.xaml
14:04:22.111 [7] DEBUG - Creating compound for TestWpfApp.Window1
14:04:22.113 [1] DEBUG - ParseInformationUpdated C:\Users\Orr\Documents\SharpDevelop Projects\TestWpfApp\TestWpfApp\Window1.xaml new!=null:True
---- Post-error application state information:
Installed 3rd party AddIns:
Workbench.ActiveContent: ICSharpCode.WpfDesign.AddIn.WpfViewContent
ProjectService.OpenSolution: [Solution: FileName=C:\Users\Orr\Documents\SharpDevelop Projects\TestWpfApp\TestWpfApp.sln, HasProjects=True, ReadOnly=False]
ProjectService.CurrentProject: [CSharpProject: TestWpfApp]