Member AutoSync failure from LINQ RRS feed

  • Question

  • My application generated the following error message recently

    System.InvalidOperationException: Member AutoSync failure. For members to be Auto-Synced after insert, the type must either have an auto-generated identity, or a key that is not modified by the database after insert

    at System.Data.Linq.ChangeDirector.StandardChangeDirector.DynamicInsert(TrackedObject item)   

    at System.Data.Linq.ChangeDirector.StandardChangeDirector.Insert(TrackedObject item)   

    at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)   

    at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)   

    at System.Data.Linq.DataContext.SubmitChanges()   

    at UserLogManager.Add(String logDir, String connectionString, String workStationId, LogType logType, String source, LogAction logAction, String detail, String userId)

    In the dbml, I have not found property IsDbGenerated and Auto-Sync on this table, the following column is primary key

    [Column(Storage = "_gLogID", DbType = "UniqueIdentifier NOT NULL", IsPrimaryKey = true)]

    The error happens sometimes, but not always.

    Any idea to troubleshoot the problem?



    Thursday, January 14, 2016 9:51 AM


All replies

  • HI Tony,

    Since our forum is discussing about VS general question like how to set/configure Visual Studio and Visual Studio tools.

    For your question, it is more related to LINQ to SQL, I moved it to the LINQ to SQL forum for better support.

    Thanks for your understanding.

    Best Regards,

    Lake Xiao

    Friday, January 15, 2016 5:57 AM
  • Hi tonylck,

    According to your description and error message, I suppose that the table has the value on primary key field before you insert into a record. You could make a log and record the primary key field value when the insert method gets an exception. And then check if the value has already existing in the table.

    Best regards,

    Cole Wu

    Tuesday, January 19, 2016 8:45 AM
  • Here's an alternative "answer" - not based on "I suppose"

    We got this error during db.SubmitChanges on a long-running batch job (console application) that inserts about 25 rows with identity primary keys every six minutes. Out of about 27000 inserts processed so far over a 4 day period, we got this error -

    'Error during Insert_OASIS_ScanRow(): call db.SubmitChanges: Member AutoSync failure. For members to be AutoSynced after insert, the type must either have an auto-generated identity, or a key that is not modified by the database after insert.'

    on one insert and

    'Error during Insert_OASIS_ScanRow(): call db.SubmitChanges: This SqlTransaction has completed; it is no longer usable.'

    on 4 other inserts. All occurred and were logged when the database was briefly unavailable during system maintenance.

    At all other times the inserts are successful and continue as I write this.

    Tuesday, April 9, 2019 12:55 PM