{"record":{"id":"279d97f3b5238814","repo":"stride3d/stride","slug":"platform-type-is-not-in-assetregistry-supportedplatforms","errorCode":null,"errorMessage":"Platform {type} is not in AssetRegistry.SupportedPlatforms.","messagePattern":"Platform (.+?) is not in AssetRegistry\\.SupportedPlatforms\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Assets/Templates/UpdatePlatformsGenerator.cs","lineNumber":288,"sourceCode":"                if (rewritten == content)\n                    log.Warning($\"Could not repoint the game-library reference in {dirName} (expected '{templatedRef}'); it may point at a stale library path.\");\n                else\n                    File.WriteAllText(csprojPath, rewritten);\n            }\n            var project = (SolutionProject)Package.LoadProject(log, csprojPath);\n            project.Type = ProjectType.Executable;\n            project.Platform = type;\n            parameters.Package.Session.Projects.Add(project);\n            log.Info($\"Registered {dirName}\");\n        }\n        return true;\n    }\n\n    /// <summary>Maps <see cref=\"PlatformType\"/> to the dotnet new <c>platforms</c> choice string (lowercased <see cref=\"SolutionPlatformPart.Name\"/>).</summary>\n    private static string PlatformChoiceName(PlatformType type)\n    {\n        var platform = AssetRegistry.SupportedPlatforms.FirstOrDefault(p => p.Type == type)\n            ?? throw new NotSupportedException($\"Platform {type} is not in AssetRegistry.SupportedPlatforms.\");\n        return platform.Name.ToLowerInvariant();\n    }\n}\n","sourceCodeStart":270,"sourceCodeEnd":292,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Assets/Templates/UpdatePlatformsGenerator.cs#L270-L292","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ndotnet new platforms -p Windows,UWP,XboxOne // UWP not registered in this build\n// after\ndotnet new platforms -p Windows,Linux,Android","handlingStrategy":"validation","validationCode":"var requested = PlatformType.Windows; // parsed from CLI\nif (!AssetRegistry.SupportedPlatforms.Any(p => p.Type == requested))\n    throw new ArgumentException($\"Platform {requested} is not registered in AssetRegistry.SupportedPlatforms\");","typeGuard":"bool IsSupportedPlatform(PlatformType t) =>\n    AssetRegistry.SupportedPlatforms.Any(p => p.Type == t);","tryCatchPattern":"try\n{\n    GeneratePlatforms(types);\n}\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"AssetRegistry.SupportedPlatforms\"))\n{\n    logger.Error($\"Unknown platform requested: {ex.Message}\");\n}","preventionTips":["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"],"tags":["templates","platform","asset-registry"],"backgroundTag":"unsupported-platform","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}