{"record":{"id":"9fab5293e592181f","repo":"dotnet/efcore","slug":"compound-assignment-not-supported-yet","errorCode":null,"errorMessage":"Compound assignment not supported yet.","messagePattern":"Compound assignment not supported yet\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Design/Query/Internal/RuntimeModelLinqToCSharpSyntaxTranslator.cs","lineNumber":135,"sourceCode":"    ///     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    protected override void TranslateNonPublicMemberAssignment(\n        MemberExpression memberExpression,\n        Expression value,\n        SyntaxKind assignmentKind)\n    {\n        var propertyInfo = memberExpression.Member as PropertyInfo;\n        var member = propertyInfo?.SetMethod ?? memberExpression.Member;\n        if (_memberAccessReplacements?.TryGetValue(member, out var methodName) == true)\n        {\n            AddNamespace(methodName.Namespace);\n            if (propertyInfo != null)\n            {\n                if (assignmentKind is not SyntaxKind.SimpleAssignmentExpression)\n                {\n                    throw new NotImplementedException(\"Compound assignment not supported yet.\");\n                }\n\n                Result = InvocationExpression(\n                    IdentifierName(methodName.Name),\n                    ArgumentList(\n                        SeparatedList(\n                        [\n                            Argument(Translate<ExpressionSyntax>(memberExpression.Expression)),\n                            Argument(Translate<ExpressionSyntax>(value))\n                        ])));\n            }\n            else\n            {\n                Result = AssignmentExpression(\n                    assignmentKind,\n                    InvocationExpression(\n                        IdentifierName(methodName.Name),\n                        ArgumentList(SeparatedList([Argument(Translate<ExpressionSyntax>(memberExpression.Expression))]))),","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Design/Query/Internal/RuntimeModelLinqToCSharpSyntaxTranslator.cs#L117-L153","documentation":"Thrown in RuntimeModelLinqToCSharpSyntaxTranslator.TranslateNonPublicMemberAssignment (line 135) while generating the runtime/compiled model. When a non-public property setter has been replaced by a method call (memberAccessReplacements), the translator only knows how to emit a simple assignment; a compound assignment (+=, -=, *=, etc.) is not yet implemented and throws NotImplementedException.","triggerScenarios":"Generating a compiled model where a runtime annotation/value uses a compound assignment to a non-public property whose access is replaced by a helper method. The code checks assignmentKind is not SyntaxKind.SimpleAssignmentExpression and throws before constructing the InvocationExpression.","commonSituations":"An EF Core version or model configuration that produces a compound assignment to a replaced non-public setter during compiled-model generation. Custom annotations or runtime model customizations that mutate via +=/-=. Generally an internal codegen gap rather than a normal user configuration path.","solutions":["Upgrade EF Core to a version that implements compound assignment translation for runtime model codegen.","Simplify the model configuration that triggers the compound assignment (e.g. avoid configurations producing accumulated += assignments).","Report the issue with the entity/property from the message if it persists, as it indicates an unimplemented codegen path.","Temporarily disable compiled-model generation for the affected model until supported."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* generate compiled model */ }\ncatch (NotImplementedException ex) when (ex.Message == \"Compound assignment not supported yet.\")\n{ /* simplify model config; report issue; retry after upgrade */ }","preventionTips":["Avoid model configurations that produce compound assignments to replaced non-public setters.","Keep EF Core tooling and runtime versions aligned.","Report the entity/property if the path is reached."],"tags":["ef-core","compiled-model","code-generation","design-time"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}