An error occurs when I try to save unmodified entity object

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 8.1.1
    • Affects Version/s: 8.1.0
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      when I modify the state of the object in the context manually...

      var obj = dbContext.Examples.First(o => o.Id == 1)
      dbContext.Entry(obj).State = EntityState.Modified; 

      and do not make any changes to its properties...

      // no changes performed
      
      dbContext.SaveChanges();

      I get the following error:

      Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: Conflicts were detected when performing updates to 'QRCodeFacilStg.Files'. Did not perform 1 modifications, 0 insertions, and 0 deletions.
         at MongoDB.EntityFrameworkCore.Storage.MongoDatabaseWrapper.AssertWritesApplied(MongoUpdateBatch batch, BulkWriteResult`1 result, CollectionNamespace collectionNamespace)
         at MongoDB.EntityFrameworkCore.Storage.MongoDatabaseWrapper.WriteBatchesAsync(IEnumerable`1 updates, IClientSessionHandle session, CancellationToken cancellationToken)
         at MongoDB.EntityFrameworkCore.Storage.MongoDatabaseWrapper.SaveChangesAsync(IList`1 entries, CancellationToken cancellationToken)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
         at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
         at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) 

            Assignee:
            Damien Guard
            Reporter:
            Edgar Mesquita
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: