stride3d/stride · warning · NotSupportedException
Grouping elements into a user library type isn't supported.
Error message
Grouping elements into a user library type isn't supported.
What it means
UIEditorBaseViewModel.GroupInto wraps the selected elements into a new parent panel of the given factory's type. Only system-library panel types are supported; if the factory resolves from a user (custom) library, the target type is null and NotSupportedException is thrown, because instantiating user library types as grouping containers is not implemented.
Solutions
- Restrict the group-into menu to system-library panel factories (UIElementFromSystemLibrary whose type is a Panel).
- Group into a built-in panel type such as Grid or StackPanel.
- Disable or hide the grouping command for user library factories.
- Extend GroupInto to resolve user library types if grouping into custom panels is required.
Example fix
// before
viewModel.GroupInto(customFactory); // throws
// after
if (customFactory is UIElementFromSystemLibrary)
viewModel.GroupInto(customFactory);
else
logger.Warning("Grouping into user library panel types is not supported.");
Defensive patterns
Strategy: type-guard
Validate before calling
if (!(factory is UIElementFromSystemLibrary sys) || !typeof(Panel).IsAssignableFrom(sys.Type)) return; // unsupported grouping target
Type guard
bool CanGroupInto(IUIElementFactory factory) => factory is UIElementFromSystemLibrary sys && typeof(Panel).IsAssignableFrom(sys.Type);
Try / catch
try { viewModel.GroupInto(factory); }
catch (NotSupportedException ex) when (ex.Message.Contains("user library type")) {
// notify user: grouping supports built-in panel types only
} Prevention
- Restrict group-into menus to system-library panel factories.
- Use Grid/StackPanel as default grouping containers.
- Guard the grouping command's CanExecute with a factory type check.
- Hide user library factories from grouping UI.
When it happens
Trigger: Executing 'group into' with an IUIElementFactory that is not UIElementFromSystemLibrary — e.g. grouping selected elements into a user-defined panel type from a custom library via the editor's group command.
Common situations: Users with custom UI element libraries selecting elements and choosing 'group into <custom panel>'; editor extensions exposing all factories to the grouping command.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Changing the panel from a user library type is currently…
- The given parentId does not correspond to any existing part.
- The control corresponding to the given parentId is a…
- The given assetSidePart.Id does not correspond to any…
- The given element is not a child of this panel.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/c21b72de6f7a8459.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Assets.Presentation/AssetEditors/UIEditor/ViewModels/UIEditorBaseViewModel.cs:592
CreateAssetFromSelectedParts(() => new UIPageAsset { Design = new UIAssetBase.UIDesign { Resolution = UIAsset.Design.Resolution } }, e => e?.Name ?? "UIPage", false, out idRemappings);
}
/// <summary>
/// Retrieves an enumeration of elements at the given UI-space position.
/// </summary>
/// <param name="worldPosition"></param>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private IEnumerable<UIElementViewModel> GetElementsAtPosition(ref Vector3 worldPosition)
{
return Controller.AdornerService.GetElementIdsAtPosition(ref worldPosition).Select(id => FindPartViewModel(new AbsoluteId(Asset.Id, id))).OfType<UIElementViewModel>();
}
private void GroupInto(IUIElementFactory factory)
{
var targetPanelType = (factory as UIElementFromSystemLibrary)?.Type;
if (targetPanelType == null)
throw new NotSupportedException("Grouping elements into a user library type isn't supported.");
if (!typeof(Panel).IsAssignableFrom(targetPanelType))
throw new ArgumentException(@"The target type isn't a panel", nameof(targetPanelType));
if (SelectedContent.Count == 0)
return;
// Ensure that the selected elements are sibling.
var allParents = SelectedItems.Select(x => x.Parent).OfType<UIHierarchyItemViewModel>().ToList();
var parent = allParents[0];
if (allParents.Any(x => x != parent))
throw new InvalidOperationException("This operation can only be executed on a selection of sibling elements.");
using (var transaction = UndoRedoService.CreateTransaction())
{
var children = SelectedItems.ToList();
// Create the new panel into which we'll insert the selection
var newPanel = (Panel)Activator.CreateInstance(targetPanelType);
var newPanelDesign = new UIElementDesign(newPanel);View on GitHub (pinned to 96fad776d2)