none
Custom conflict resolver and table(s) with Date data type error

    Question

  • We have encountered an issue syncing with a custom business logic handler where our tables are using the Date data type.  We are using SQL server 2008 R2 SP1 standard at the publisher and either developer edition or express (same versions as pub) at the subscriber.  We first setup the publication with the custom resolver registered and added to each merge article that is bi-directional.  Then we setup the subscriber and start syncing.  The sync process bombs (with generic error: merge process could not enumerate changes at the publisher) as soon as it encounters a merge article that has the Date dataype (it must have data in the table).  I have removed all code from the business logic handler and I am essentially just letting it pass through so I know it is not any of our code in the resolver causing a problem.  If we change the data type to datetime it works just fine.  The custom resolver is built using .net 4.0 by the way.  I am wondering if this issue can be reproduced and if there is a workaround.  Our preference would be that we could use this data type but for now we have to switch to datetime to get around the problem.  If you have any ideas on how to solve this it would be greatly appreciated.  Thanks!

    -Mike

    Thursday, March 01, 2012 3:32 PM

All replies

  • You need to debug the business logic handler and see why it is bombing on articles with a Date datatype.  This way you can get the exception details.

    Instructions on how to debug a business logic handler can be found in How to: Debug a Business Logic Handler (Replication Programming).


    Brandon Williams (blog | twitter)

    Thursday, March 01, 2012 5:39 PM
  • I am familiar with debugging the business logic handler, but I'm not sure it helps in this case.  What I was trying to describe in my initial post is that currently I have taken almost all code out of my business logic handler.  The only thing it has the HandleChangeStates and UpdateConflictsHandler overrides with no custom code in them (see below).  The error happens on the initial sync for the subscriber so this would mean that the error is occurring on inserts to the subscriber database.  There is no spot in my business logic handler that I can put a break point that will get hit other than the ctor/init or the handleChangeStates.  As soon as it gets to an article with Date data type it fails.  Perhaps I am missing something but I'm not sure what exactly to debug in the business logic handler.   If you have any further suggestions please let me know.

    Thanks,

    Mike

    Business logic handler code (this is the only thing that has been added/modified):

            override public ChangeStates HandledChangeStates
            {
                get
                {
                    return ChangeStates.UpdateConflicts;
                }
            }
    
            public override ActionOnUpdateConflict UpdateConflictsHandler(DataSet publisherDataSet, DataSet subscriberDataSet, ref DataSet customDataSet, ref ConflictLogType conflictLogType, ref string customConflictMessage, ref int historyLogLevel, ref string historyLogMessage)
            {
                return ActionOnUpdateConflict.AcceptDefaultResolution;
            }

    EDIT:  I suppose I can override the InsertHandler and see if that gets me anywhere.  I can try that, but the point I was trying to make is that the insert is failing and I don't have any custom code that would be affecting it.
    • Edited by HoldinSteady Thursday, March 01, 2012 7:02 PM adding more info
    Thursday, March 01, 2012 6:59 PM
  • Mike,

    When you say the error happens on 'initial sync' do you mean the error occurs while the snapshot is being applied?

    If so, the error may not be related to the business logic handler.  In this case I would enable verbose agent logging to get some more details about the error.  Add the parameters -OutputVerboseLevel 4 -Output C:\TEMP\mergeagent.log to the Merge Agent profile, rerun the Merge Agent, and examine the log for more details.


    Brandon Williams (blog | twitter)

    Thursday, March 01, 2012 7:37 PM
  • That is what i mean.  I apologize for not mentioning all the details of my tests up to this point, but I have already done what you suggested and enabled verbose logging.  The log file does not provide any more details than the error message I see in the application or repl monitor.  If i remove the business logic handler it syncs correctly.  If I change the datatype to datetime it syncs correctly. 


    Thursday, March 01, 2012 8:16 PM