{"record":{"id":"edfd8c6c669d6d4e","repo":"dotnet/efcore","slug":"memberaccess-couldn-t-find-symbol-for-member-me","errorCode":null,"errorMessage":"MemberAccess: Couldn't find symbol for member: {memberAccess}","messagePattern":"MemberAccess: Couldn't find symbol for member: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Design/Query/Internal/CSharpToLinqTranslator.cs","lineNumber":772,"sourceCode":"    /// </summary>\n    public override Expression VisitLiteralExpression(LiteralExpressionSyntax literal)\n        => _semanticModel.GetTypeInfo(literal) is { ConvertedType: { } type }\n            ? Constant(literal.Token.Value, ResolveType(type))\n            : Constant(literal.Token.Value);\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    public override Expression VisitMemberAccessExpression(MemberAccessExpressionSyntax memberAccess)\n    {\n        var expression = Visit(memberAccess.Expression);\n\n        if (_semanticModel.GetSymbolInfo(memberAccess).Symbol is not { } memberSymbol)\n        {\n            throw new InvalidOperationException($\"MemberAccess: Couldn't find symbol for member: {memberAccess}\");\n        }\n\n        var containingType = ResolveType(memberSymbol.ContainingType);\n        var memberInfo = memberSymbol switch\n        {\n            IPropertySymbol p => (MemberInfo?)containingType.GetProperty(p.Name),\n            IFieldSymbol f => containingType.GetField(f.Name),\n            INamedTypeSymbol t => containingType.GetNestedType(t.Name),\n\n            null => throw new InvalidOperationException($\"MemberAccess: Couldn't find symbol for member: {memberAccess}\"),\n            _ => throw new NotSupportedException($\"MemberAccess: unsupported member symbol '{memberSymbol.GetType().Name}': {memberAccess}\")\n        };\n\n        switch (memberInfo)\n        {\n            case Type nestedType:\n                return Constant(nestedType);\n","sourceCodeStart":754,"sourceCodeEnd":790,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Design/Query/Internal/CSharpToLinqTranslator.cs#L754-L790","documentation":"VisitMemberAccessExpression throws InvalidOperationException when Roslyn cannot resolve a member access (a.B) to any symbol. The translator needs the member symbol to map it to a reflection PropertyInfo/FieldInfo.","triggerScenarios":"A member access where GetSymbolInfo(memberAccess).Symbol is null: a typo, a member on an error/unresolved type, dynamic member access, or a member that only exists in an unreferenced assembly.","commonSituations":"Misspelled property names; accessing members of types from namespaces/assemblies not referenced by the precompilation; accessing members of dynamic-typed expressions.","solutions":["Verify the member name and that the containing type is referenced by the precompilation","Make sure the query compiles cleanly in the IDE before precompiling","Remove dynamic member access; use strongly-typed variables"],"exampleFix":"// before (typo / unresolved)\nvar q = ctx.Blogs.Where(b => b.Titel == \"x\");\n// after\nvar q = ctx.Blogs.Where(b => b.Title == \"x\");","handlingStrategy":"validation","validationCode":"// Ensure the query is error-free in the IDE (Roslyn would otherwise fail to bind the member).\n// Confirm the member exists and the containing type is referenced.\nvar pi = typeof(Entity).GetProperty(nameof(Entity.Title));\nif (pi is null) { /* fix typo / add reference */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build the project with zero errors/warnings before precompiling queries","Double-check property names for typos","Reference every assembly whose types are accessed in the query"],"tags":["efcore","precompiled-queries","roslyn","member-resolution","csharp"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}