DetectChanges can result in "the property has a temporary value" error on save #15960
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-bug
Milestone
With nested entity types, calling DetectChanges can result in "the property has a temporary value" error on save, referring to the innermost entity type.
Steps to reproduce
The program execution fails with the error:
Note that the save is successful if the code is changed in any of these ways:
We can work around this problem in our "real" code, but I'm curious as to why it's happening so we know the workaround is sufficient. In our case we need to set a particular entity (that has been retrieved from a cache) to state Unchanged by accessing db.Entry(entity).State, which triggers a call to DetectChanges.
Further technical details
EF Core version: 2.2.4
.NET SDK: 2.2.104
Database Provider: Microsoft.EntityFrameworkCore.Sqlite (though in our "real" code we use SqlServer)
Operating system: Windows 10 Enterprise
IDE: Visual Studio 15.9.7
The text was updated successfully, but these errors were encountered: