stride3d/stride · error · InvalidOperationException

The asset mount point cannot be renamed

Error message

The asset mount point cannot be renamed

What it means

The asset mount point (the virtual 'Assets' root of a package) is a fixed node in the directory tree. Its Name setter deliberately throws InvalidOperationException because renaming the mount point would break package layout, and its IsEditable is false. This is an intentional guard against an unsupported operation.

Solutions

  1. Do not rename the mount point; check IsEditable first and skip non-editable nodes.
  2. If a different root name is required, that requires changing the package layout in the engine, not the editor view model.
  3. Route rename operations to DirectoryViewModel instances (subdirectories) only.

Example fix

// before
node.Name = "MyAssets";
// after
if (node.IsEditable) node.Name = "MyAssets";
Defensive patterns

Strategy: validation

Validate before calling

if (!node.IsEditable) { logger.Info("Asset root cannot be renamed"); return; }

Type guard

bool CanRename(DirectoryBaseViewModel n) => n.IsEditable && !(n is AssetMountPointViewModel);

Try / catch

try { node.Name = newName; }
catch (InvalidOperationException) { logger.Warn("Asset mount point cannot be renamed"); }

Prevention

When it happens

Trigger: Assigning any value to AssetMountPointViewModel.Name, or calling rename UI/logic on the asset root node instead of on a regular directory view model.

Common situations: Generic rename code iterating the whole directory tree without checking IsEditable; scripts trying to rebrand the 'Assets' root folder.

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


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

Appendix: source

Thrown at sources/editor/Stride.Core.Assets.Editor/ViewModel/AssetMountPointViewModel.cs:14

// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;

namespace Stride.Core.Assets.Editor.ViewModel
{
    public class AssetMountPointViewModel : MountPointViewModel
    {
        public AssetMountPointViewModel(PackageViewModel package)
            : base(package)
        {
        }

        public override string Name { get { return "Assets"; } set { throw new InvalidOperationException("The asset mount point cannot be renamed"); } }

        public override bool IsEditable => false;

        public override bool CanDelete(out string error)
        {
            error = "Unable to delete the asset root folder.";
            return false;
        }

        public override bool AcceptAssetType(Type assetType)
        {
            return !typeof(IProjectAsset).IsAssignableFrom(assetType);
        }
    }
}

View on GitHub (pinned to 96fad776d2)