{"record":{"id":"7cf83680ebc80a20","repo":"litedb-org/LiteDB","slug":"member-member-name-are-not-support-in-member-de","errorCode":null,"errorMessage":"Member {member.Name} are not support in {member.DeclaringType.Name} when convert to BsonExpression ({node.ToString()}).","messagePattern":"Member (.+?) are not support in (.+?) when convert to BsonExpression \\((.+?)\\)\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"LiteDB/Client/Mapper/Linq/LinqExpressionVisitor.cs","lineNumber":143,"sourceCode":"            return base.VisitParameter(node);\n        }\n\n        /// <summary>\n        /// Visit :: x => x.`Customer.Name`\n        /// </summary>\n        protected override Expression VisitMember(MemberExpression node)\n        {\n            // test if member access is based on parameter expression or constant/external variable\n            var isParam = ParameterExpressionVisitor.Test(node);\n\n            var member = node.Member;\n\n            // special types contains method access: string.Length, DateTime.Day, ...\n            if (TryGetResolver(member.DeclaringType, out var type))\n            {\n                var pattern = type.ResolveMember(member);\n\n                if (pattern == null) throw new NotSupportedException($\"Member {member.Name} are not support in {member.DeclaringType.Name} when convert to BsonExpression ({node.ToString()}).\");\n\n                this.ResolvePattern(pattern, node.Expression, new Expression[0]);\n            }\n            else\n            {\n                // for static member, Expression == null\n                if (node.Expression != null)\n                {\n                    _memberAccessNodes.Push(node);\n\n                    base.Visit(node.Expression);\n\n                    if (isParam)\n                    {\n                        var name = this.ResolveMember(member, out _);\n\n                        _builder.Append(name);\n                    }","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/litedb-org/LiteDB/blob/f906a5f850678719e39a39a006cb66dcae563cfa/LiteDB/Client/Mapper/Linq/LinqExpressionVisitor.cs#L125-L161","documentation":"Thrown by VisitMember when a member is accessed on a type that has a registered ITypeResolver (e.g., String, DateTime, Guid, Int32, ObjectId, Regex, Math) but that resolver's ResolveMember returns null for the specific member. This means the declaring type is recognized, but the particular property or field is not in the resolver's known pattern set.","triggerScenarios":"Accessing a member on a resolver-backed type that the resolver does not support. For example x => x.CreatedAt.Ticks (DateTime has a resolver but Ticks is not a supported pattern) or x => x.Name.Chars (String has a resolver but Chars is not supported).","commonSituations":"Using a less common property of a built-in type (DateTime.Ticks, DateTime.Millisecond, String.Chars) that the resolver does not map. Expecting full parity with .NET's API surface when only a curated subset is translated. Refactoring from a supported member to an unsupported one.","solutions":["Use only the members that the built-in resolvers support (for DateTime: Year, Month, Day, Hour, Minute, Second; for String: Length and standard methods like Contains/StartsWith/ToUpper).","Hoist the computation out of the query: fetch results with a supported predicate, then compute the unsupported member in memory.","If a raw BsonExpression equivalent exists for the operation, use a string-based query instead of LINQ."],"exampleFix":"// before\nvar recent = col.Find(x => x.CreatedAt.DayOfYear > 1);\n// DayOfYear is not in DateTimeResolver\n\n// after\nvar recent = col.Find(x => x.CreatedAt.Month >= 1 && x.CreatedAt.Day > 1);","handlingStrategy":"validation","validationCode":"// Check the resolver source for supported members before using them in queries\n// DateTimeResolver supports: Year, Month, Day, Hour, Minute, Second\n// StringResolver supports: Length\n// Avoid: Ticks, Millisecond, DayOfYear, Chars\nvar testExpr = mapper.GetExpression<MyEntity, bool>(x => x.CreatedAt.Year > 2020);","typeGuard":null,"tryCatchPattern":"try\n{\n    var results = col.Find(x => x.CreatedAt.DayOfYear > 1);\n}\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"are not support in\"))\n{\n    results = col.Find(x => x.CreatedAt.Year >= 2020);\n}","preventionTips":["Familiarize yourself with the supported members in each ITypeResolver.","Keep a reference list of supported members for built-in types near your query code.","Write unit tests for each LINQ predicate to catch unsupported members at test time.","Prefer simple member comparisons (Year, Month, Day, Length) over exotic properties."],"tags":["linq","member-access","resolver"],"backgroundTag":null,"analyzedSha":"f906a5f850678719e39a39a006cb66dcae563cfa","analyzedAt":"2026-08-13T21:56:30.148Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}