stride3d/stride · error · NotSupportedException

Cannot delete a MountPointViewModel

Error message

Cannot delete a MountPointViewModel

What it means

MountPointViewModel.Delete overrides the deletable-directory contract and throws NotSupportedException: the mount point is the structural root of a package's asset tree and cannot be deleted like a folder.

Solutions

  1. Filter MountPointViewModel nodes out of delete operations
  2. Only call Delete on DirectoryViewModel/AssetViewModel nodes
  3. Handle or filter NotSupportedException in bulk delete loops

Example fix

// before
foreach (var node in selectedNodes) node.Delete();
// after
foreach (var node in selectedNodes.OfType<DirectoryViewModel>()) node.Delete();
Defensive patterns

Strategy: type-guard

Validate before calling

if (node is MountPointViewModel) throw new ArgumentException("Mount points cannot be deleted");

Type guard

bool CanDelete(DirectoryBaseViewModel n) => n is not MountPointViewModel;

Try / catch

try { node.Delete(); } catch (NotSupportedException) { /* not deletable */ }

Prevention

When it happens

Trigger: Calling Delete() on a MountPointViewModel directly, or via bulk operations (e.g. DeleteSelectedSolutionItems) that include the mount point in the selection.

Common situations: Select-all in the session explorer followed by delete; scripts enumerating tree nodes and deleting each one.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/8cf32dbb9e29650f. Report an issue: GitHub.

Appendix: source

Thrown at sources/editor/Stride.Core.Assets.Editor/ViewModel/MountPointViewModel.cs:41

        public override PackageViewModel Package { get; }

        /// <inheritdoc/>
        public override string TypeDisplayName => "Mount Point";

        /// <inheritdoc/>
        public override IEnumerable<IDirtiable> Dirtiables => base.Dirtiables.Concat(Package.Dirtiables);

        public IReadOnlyCollection<DirectoryBaseViewModel> GetDirectoryHierarchy()
        {
            var hierarchy = new List<DirectoryBaseViewModel>();
            GetDirectoryHierarchy(hierarchy);
            return hierarchy;
        }

        public override void Delete()
        {
            throw new NotSupportedException("Cannot delete a MountPointViewModel");
        }

        public abstract bool AcceptAssetType(Type assetType);

        protected override void UpdateIsDeletedStatus()
        {
            throw new NotImplementedException();
        }
    }
}

View on GitHub (pinned to 96fad776d2)