While working my EF core Application I was getting this exception message. I fixed this issue like this
Step 1: In Insert/update method make ensure to detach the entity.
_db.Entry(localRopFiles).State = EntityState.Detached;
Step 2: If you are loading data on page load then use AsNoTracking() method
var query = await _db.LocalRopFiles.AsNoTracking().ToListAsync();
I hope this will help some one who is getting this type of exception.