You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there is a jsonb field on the data table and it is mapped using ToJson(), and the jsonb field has not been modified. using the UpdateMany() method will result in an error:
System.InvalidOperationException: The value of shadow key property 'ProduceTrackingCuttingRequire.Id' is unknown when attempting to save changes. This is because shadow property values cannot be preserved when the entity is not being tracked. Consider adding the property to the entity's .NET type. See https://aka.ms/efcore-docs-owned-collections for more information.
But when I use the Update() method within a loop, there is no issue.
Reproduction Steps
No response
Expected behavior
No response
Actual behavior
No response
Regression?
No response
Known Workarounds
No response
Version
8.0.5
User Interface
Angular
Database Provider
EF Core (Default)
Tiered or separate authentication server
Tiered
Operation System
Linux
Other information
No response
The text was updated successfully, but these errors were encountered:
Applications often make errors after a recent upgrade to.NET 8, I found that if I used tojson() to map jsonb fields, I encountered this problem when I manually enabled multiple UnitOfWorks, and I didn't encounter this problem when I fell back on the tojson() method to HasColumnType("jsonb"). Also note that I made an http request in the UnitOfWork:
Npgsql.NpgsqlException: Exception while writing to stream
---> System.IO.IOException: Unable to write data to the transport connection: Operation canceled.
---> System.Net.Sockets.SocketException: Operation canceled
at Npgsql.Internal.NpgsqlWriteBuffer.d__32.MoveNext() at offset 282
--- End of inner exception stack trace ---
at Npgsql.Internal.NpgsqlWriteBuffer.d__32.MoveNext() at offset 682
at Npgsql.NpgsqlCommand.<g__WriteExecute|100_0>d.MoveNext() at offset 1709
at Npgsql.NpgsqlCommand.d__119.MoveNext() at offset 1155
at Npgsql.NpgsqlCommand.d__107.MoveNext() at offset 146
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.d__14.MoveNext() at offset 779
at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.d__17.MoveNext() at offset 279
When this error occurs, the database fails to log the error log most of the time, Occasionally, however, the following errors are recorded:
ERROR: SAVEPOINT can only be used in transaction blocks
And this problem seems to exist only in certain scenarios, for example, I run it perfectly in debug mode on my macbook, but I run it 3-4 times out of 10 on ubuntu
choby
changed the title
An error issue when using both ToJson() and UpdateMany() methods
An error issue when using both ToJson() and UpdateMany() methods or manually enabled multiple UnitOfWorks
Apr 30, 2024
Is there an existing issue for this?
Description
When there is a jsonb field on the data table and it is mapped using ToJson(), and the jsonb field has not been modified. using the UpdateMany() method will result in an error:
System.InvalidOperationException: The value of shadow key property 'ProduceTrackingCuttingRequire.Id' is unknown when attempting to save changes. This is because shadow property values cannot be preserved when the entity is not being tracked. Consider adding the property to the entity's .NET type. See https://aka.ms/efcore-docs-owned-collections for more information.
But when I use the Update() method within a loop, there is no issue.
Reproduction Steps
No response
Expected behavior
No response
Actual behavior
No response
Regression?
No response
Known Workarounds
No response
Version
8.0.5
User Interface
Angular
Database Provider
EF Core (Default)
Tiered or separate authentication server
Tiered
Operation System
Linux
Other information
No response
The text was updated successfully, but these errors were encountered: