{"record":{"id":"c9cfc67258bdd4be","repo":"microsoft/aspire","slug":"embedded-dashboard-database-schema-script-resourcename-was","errorCode":null,"errorMessage":"Embedded dashboard database schema script '{resourceName}' was not found.","messagePattern":"Embedded dashboard database schema script '(.+?)' was not found\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/Aspire.Dashboard/ServiceClient/DashboardSqliteDatabase.cs","lineNumber":207,"sourceCode":"    private static IReadOnlyList<string> LoadSchemaScripts()\n    {\n        var assembly = typeof(DashboardSqliteDatabase).Assembly;\n        // Numeric filename prefixes define execution order because later schema domains reference tables created by earlier scripts.\n        var resourceNames = assembly.GetManifestResourceNames()\n            .Where(name => name.StartsWith(SchemaResourcePrefix, StringComparison.Ordinal) && name.EndsWith(\".sql\", StringComparison.Ordinal))\n            .Order(StringComparer.Ordinal)\n            .ToArray();\n\n        if (resourceNames.Length == 0)\n        {\n            throw new InvalidOperationException(\"No embedded dashboard database schema scripts were found.\");\n        }\n\n        var scripts = new List<string>(resourceNames.Length);\n        foreach (var resourceName in resourceNames)\n        {\n            using var stream = assembly.GetManifestResourceStream(resourceName)\n                ?? throw new InvalidOperationException($\"Embedded dashboard database schema script '{resourceName}' was not found.\");\n            using var reader = new StreamReader(stream);\n            scripts.Add(reader.ReadToEnd());\n        }\n\n        return scripts;\n    }\n\n    private static bool ValidateSchemaVersion(SqliteConnection connection, IDbTransaction? transaction, int expectedVersion)\n    {\n        // Opening the database and setting WAL creates a valid SQLite file before the schema transaction\n        // commits, so an interrupted first initialization leaves a file with no dashboard_schema table.\n        // Querying it directly throws \"no such table: dashboard_schema\", and because Resume only replaces\n        // the database when this returns false, every later start would keep crashing.\n        //\n        // Probe sqlite_master first so a missing schema table reports \"not compatible\" while genuine IO,\n        // locking, and corruption failures still surface as exceptions.\n        // See https://www.sqlite.org/schematab.html\n        var schemaTableCount = connection.QuerySingle<long>(\"\"\"","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Dashboard/ServiceClient/DashboardSqliteDatabase.cs#L189-L225","documentation":"The dashboard's embedded SQLite database schema is loaded from resources embedded in the Aspire.Dashboard assembly. LoadSchemaScripts reads each expected embedded manifest resource stream by name; if the assembly does not contain a script with that name, it throws this InvalidOperationException. This almost always indicates a build or packaging problem rather than a caller mistake.","triggerScenarios":"An assembly.GetManifestResourceStream(resourceName) call returns null because the .sql schema files were not embedded (missing EmbeddedResource entries), the assembly was repackaged/trimmed, or a version mismatch leaves the resource name expected by the code absent from the loaded assembly.","commonSituations":"Running a partially-built or modified Aspire.Dashboard assembly, custom builds that strip embedded resources, loading the dashboard types from a mismatched assembly version, or resource-name refactors that did not update the resource list.","solutions":["Rebuild the Aspire.Dashboard package/assembly from a clean state so schema scripts are embedded again","Verify the dashboard assemblies are all from the same Aspire version and were not trimmed or altered","Check that schema .sql files remain marked as EmbeddedResource in the Aspire.Dashboard project","If you hit this consistently, file an issue against Aspire with the resource name and assembly version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var names = assembly.GetManifestResourceNames();\nif (!names.Contains(resourceName))\n{\n    throw new InvalidOperationException($\"Schema script '{resourceName}' missing from {assembly.FullName}\");\n}","typeGuard":null,"tryCatchPattern":"try { var scripts = LoadSchemaScripts(assembly, resourceNames); }\ncatch (InvalidOperationException ex)\n{\n    logger.LogError(ex, \"Embedded dashboard schema missing; assembly may be corrupt or mismatched\");\n}","preventionTips":["Verify .sql schema files are EmbeddedResource entries in the project file","Avoid trimming/modifying Aspire.Dashboard assemblies","Keep all dashboard-related assemblies on the same Aspire version"],"tags":["embedded-resources","dashboard","sqlite","assembly"],"backgroundTag":"resource-not-found","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}