{"record":{"id":"daae912e71b2ca29","repo":"dotnet/efcore","slug":"could-not-find-type-symbol-for-fullyqualifiedmet-daae91","errorCode":null,"errorMessage":"Could not find type symbol for: {fullyQualifiedMetadataName}","messagePattern":"Could not find type symbol for: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/EFCore.Design/Query/Internal/PrecompiledQueryCodeGenerator.cs","lineNumber":1362,"sourceCode":"                GetTypeSymbolOrThrow(\"System.Collections.Generic.IAsyncEnumerable`1\");\n            GenericEnumerator =\n                GetTypeSymbolOrThrow(\"System.Collections.Generic.IEnumerator`1\");\n            IQueryable =\n                GetTypeSymbolOrThrow(\"System.Linq.IQueryable`1\");\n            IOrderedQueryable =\n                GetTypeSymbolOrThrow(\"System.Linq.IOrderedQueryable`1\");\n            IIncludableQueryable =\n                GetTypeSymbolOrThrow(\"Microsoft.EntityFrameworkCore.Query.IIncludableQueryable`2\");\n            GenericTask =\n                GetTypeSymbolOrThrow(\"System.Threading.Tasks.Task`1\");\n        }\n\n        public static Symbols Load(Compilation compilation)\n            => new(compilation);\n\n        private INamedTypeSymbol GetTypeSymbolOrThrow(string fullyQualifiedMetadataName)\n            => _compilation.GetTypeByMetadataName(fullyQualifiedMetadataName)\n                ?? throw new InvalidOperationException(\"Could not find type symbol for: \" + fullyQualifiedMetadataName);\n    }\n}\n","sourceCodeStart":1344,"sourceCodeEnd":1365,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Design/Query/Internal/PrecompiledQueryCodeGenerator.cs#L1344-L1365","documentation":"Thrown in PrecompiledQueryCodeGenerator.Symbols.GetTypeSymbolOrThrow (line 1362) during one-time symbol loading. The Symbols struct looks up a fixed set of core framework types (IEnumerable`1, IAsyncEnumerable`1, IEnumerator`1, IQueryable`1, IOrderedQueryable`1, IIncludableQueryable`2, Task`1); if any is missing from the compilation it throws. This means the Roslyn Compilation lacks the fundamental framework references needed to generate interceptor code at all.","triggerScenarios":"Symbols.Load is called on a Compilation that cannot resolve one of the hardcoded fully-qualified metadata names (e.g. System.Linq.IQueryable`1, System.Threading.Tasks.Task`1, Microsoft.EntityFrameworkCore.Query.IIncludableQueryable`2). GetTypeByMetadataName returns null and GetTypeSymbolOrThrow throws.","commonSituations":"Running precompiled-query generation against a project whose Compilation has no reference to System.Linq, the BCL facade assemblies, or the EF Core assembly (IIncludableQueryable). Misconfigured analyzer/source-generator host that strips framework references. A project type that does not reference the full framework (e.g. a minimal library without System.Linq).","solutions":["Add framework references so the compilation can resolve System.Linq, System.Threading.Tasks, and the EF Core assemblies (e.g. reference Microsoft.EntityFrameworkCore and a TargetFramework that includes System.Linq).","Run the EF tools against a project whose TargetFramework and PackageReferences include EF Core and the BCL.","Verify the analyzer/source-generator is invoked with the project's full reference set, not a stripped one.","Clean/rebuild and confirm the project compiles standalone before running precompilation."],"exampleFix":"<!-- before: project missing EF Core / framework references -->\n<ItemGroup>\n  <PackageReference Include=\"Microsoft.EntityFrameworkCore\" Version=\"9.0.0\" />\n</ItemGroup>\n\n<!-- after: include relational/design-time packages and a framework that provides System.Linq -->\n<ItemGroup>\n  <PackageReference Include=\"Microsoft.EntityFrameworkCore\" Version=\"9.0.0\" />\n  <PackageReference Include=\"Microsoft.EntityFrameworkCore.SqlServer\" Version=\"9.0.0\" />\n  <PackageReference Include=\"Microsoft.EntityFrameworkCore.Design\" Version=\"9.0.0\">\n    <PrivateAssets>all</PrivateAssets>\n  </PackageReference>\n</ItemGroup>","handlingStrategy":"validation","validationCode":"// Verify the compilation can resolve the core symbols before Symbols.Load\nstring[] required = {\n    \"System.Linq.IQueryable`1\",\"System.Threading.Tasks.Task`1\",\n    \"Microsoft.EntityFrameworkCore.Query.IIncludableQueryable`2\"\n};\nvar missing = required.Where(n => compilation.GetTypeByMetadataName(n) is null).ToList();\nif (missing.Count != 0) { /* add framework/EF references */ }","typeGuard":null,"tryCatchPattern":"try { Symbols.Load(compilation); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Could not find type symbol\"))\n{ /* fix references so System.Linq / EF Core are visible, then retry */ }","preventionTips":["Target a framework and reference set that includes System.Linq and EF Core.","Run precompilation only against projects that reference EF Core.","Restore packages and clean/rebuild before generating."],"tags":["ef-core","precompiled-query","type-resolution","roslyn","design-time"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}