stride3d/stride · error · NotSupportedException
Platform is not in AssetRegistry.SupportedPlatforms.
Error message
Platform {type} is not in AssetRegistry.SupportedPlatforms. What it means
UpdatePlatformsGenerator.PlatformChoiceName maps a PlatformType to the dotnet-new 'platforms' template choice by looking it up in AssetRegistry.SupportedPlatforms; if no entry with that Type exists it throws NotSupportedException. This is an internal lookup invariant: the generator was asked to generate for a platform the asset registry does not know.
Solutions
- Use only platform names listed in AssetRegistry.SupportedPlatforms for your build (e.g. Windows, Linux, Android, iOS).
- Check for typos or stale values in scripts invoking the platforms template.
- If using a custom platform, ensure its registration code runs before the generator executes.
- If a platform was intentionally removed, drop it from the requested platform list.
Example fix
// before dotnet new platforms -p Windows,UWP,XboxOne // UWP not registered in this build // after dotnet new platforms -p Windows,Linux,Android
Defensive patterns
Strategy: validation
Validate before calling
var requested = PlatformType.Windows; // parsed from CLI
if (!AssetRegistry.SupportedPlatforms.Any(p => p.Type == requested))
throw new ArgumentException($"Platform {requested} is not registered in AssetRegistry.SupportedPlatforms"); Type guard
bool IsSupportedPlatform(PlatformType t) =>
AssetRegistry.SupportedPlatforms.Any(p => p.Type == t); Try / catch
try
{
GeneratePlatforms(types);
}
catch (NotSupportedException ex) when (ex.Message.Contains("AssetRegistry.SupportedPlatforms"))
{
logger.Error($"Unknown platform requested: {ex.Message}");
} Prevention
- Derive the platform list from AssetRegistry.SupportedPlatforms instead of hardcoding
- Validate CLI platform arguments against the registry before invoking templates
- Update generation scripts when platforms are added or removed from a build
When it happens
Trigger: Calling the UpdatePlatforms project-template generator (e.g. `dotnet new platforms -p <types>`) with a platform type not present in AssetRegistry.SupportedPlatforms — e.g. an unknown/custom PlatformType value or a platform compiled out of the registry.
Common situations: Passing an invalid/typo platform value to the template CLI; building a trimmed Stride where some platforms were removed from the registry but a script still requests them; plugin registering platforms after generation runs.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- Unable to find a serializer for the specified asset. No…
- Unable to find a serializer for
- Package must be added to an existing PackageSession
- [ . ] must be in
- [ ] cannot be null in
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/279d97f3b5238814.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Assets/Templates/UpdatePlatformsGenerator.cs:288
if (rewritten == content)
log.Warning($"Could not repoint the game-library reference in {dirName} (expected '{templatedRef}'); it may point at a stale library path.");
else
File.WriteAllText(csprojPath, rewritten);
}
var project = (SolutionProject)Package.LoadProject(log, csprojPath);
project.Type = ProjectType.Executable;
project.Platform = type;
parameters.Package.Session.Projects.Add(project);
log.Info($"Registered {dirName}");
}
return true;
}
/// <summary>Maps <see cref="PlatformType"/> to the dotnet new <c>platforms</c> choice string (lowercased <see cref="SolutionPlatformPart.Name"/>).</summary>
private static string PlatformChoiceName(PlatformType type)
{
var platform = AssetRegistry.SupportedPlatforms.FirstOrDefault(p => p.Type == type)
?? throw new NotSupportedException($"Platform {type} is not in AssetRegistry.SupportedPlatforms.");
return platform.Name.ToLowerInvariant();
}
}
View on GitHub (pinned to 96fad776d2)