locked
SyncTracer in ADO.NET Data Services on a mobile device RRS feed

  • Question

  • I'd like to get some trace information out of the sync process on a mobile device for an application using the Microsoft Synchronization Services for ADO.NET framework.

    As there is no app.config in a mobile device application, first I successfully switched on Trace in code, however unfortunately unlike the desktop which has a SyncTracer which does use System.Diagnostics.Trace, the trace on the mobile did not contain any information regarding the sync.

    With no documentation at hand I resorted to taking a peak at the code, and found the SyncTrace in the mobile framework looks for a "trace.config.txt" which contains XML that should look like this....

     

    <?xml version="1.0" encoding="utf-8" ?>

    <traceSettings>

      <add key="FileLocation" value="syncTrace.log" />

      <add key="LogLevel" value="4" />

    </traceSettings>

     

    However running my app with this file present in the assembly directory did not result in a syncTrace.log being created with handy information about the sync process.  Has anyone else attempted to get trace information for the sync on a mobile device?  Did you have any success?

    If you're wondering why I'm trying to switch on the trace, I'd like to know exactly how the Services for ADO.NET framework is determining the changes that have been made in the sdf sql server compact database.  It seems to just magically be able to determine the updates, inserts etc have been made which is great, but as I'm about to use it as a core component of a project I'd really like to understand whats going on under the hood.

    TIA


    Mick Lang
    • Moved by Hengzhe Li Friday, April 22, 2011 5:03 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, March 23, 2009 11:01 PM

Answers

  • Thanks Yunwen, I tried changing the contents as you've instructed, however, it still doesn't appear to work. 

    I believe it simply doesn't work, there is code there that looks like it should produce a sync trace, but there's a bug that ensures it never does.  If there's anyone at Microsoft who can change the code, I believe the problem lies in the path to the file being passed to File.Exists as a Uri

    e.g 'file:///program files/myapp/mylog.log'

    ...for whatever reason when you pass a file in this format to File.Exists(..) its coming back with false.
    Mick Lang

     

    HI Mick,

    I have make a try follow Yunwen's mention, it can be work under my device.

    And there are 2 extra points that you need to take care:

     

    1.      Make sure file "trace.config.txt" has put in your application folder on device. You may create a file named "trace.config.txt" and add to your VS solution, the VS will automatic generate this file within your app folder when you deploy App.

    2.      If you are not specify a log file path, the log will by default generate in ROOT path under device. Please take a look.

     

    Share out my trace.config.txt:

     

    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>

    <traceSettings>

    <add key ="FileLocation" value="Trace_OCS.txt"/>

    <add key ="LogLevel" value="1"/>

    </traceSettings>

    </configuration>

     

    If still not work, please tell me your build version of Sync Service for ado.net, thanks.

     


    Joey Liang
    Your potential our passion This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, April 1, 2009 3:59 AM

All replies

  • Hi Mick,

    I can't tell you about tracing sync on the mobile device, but the "magic" mostly lies in the changetracking support of SQL Server Compact. Have a look at your local device database and the additional tables and columns it contains when sync is initialized. These are used by SyncServices to retrieve which data has been inserted/updated/deleted since the last sync.

    I believe SyncServices and the whole SyncFramework are great stuff that will really push mobile app development. But for now I recommend you really thoroughly test if it fits your needs. Especially in terms of performance and stuff like identity management we are all really looking forward to the next release. At the moment we had to try several hacks because our customers simply did not accept the performance. There is no definite answer yet when the next version will be released (and if all above probs are solved).

    Andreas
    Tuesday, March 24, 2009 12:55 PM
  • If you were to create these tables yourself.  How would you do it?

    Mick Lang
    Tuesday, March 24, 2009 12:56 PM
  •  

    This is currently an undoc-ed feature, but tracing does support on sync service for device with the current release.

    On WinCE, the filename for the trace configuration is “trace.config.txt” and this file should be in the same directory as the exe.  Here is a working example:

     

    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>

       <traceSettings>

         <add key ="FileLocation" value="test.txt"/>

         <add key ="LogLevel" value="4"/>

       </traceSettings>

    </configuration>


    thanks
    Yunwen


    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Proposed as answer by Yiming L Wednesday, April 1, 2009 3:44 AM
    Wednesday, March 25, 2009 10:29 AM
    Moderator
  • Thanks Yunwen, I tried changing the contents as you've instructed, however, it still doesn't appear to work. 

    I believe it simply doesn't work, there is code there that looks like it should produce a sync trace, but there's a bug that ensures it never does.  If there's anyone at Microsoft who can change the code, I believe the problem lies in the path to the file being passed to File.Exists as a Uri

    e.g 'file:///program files/myapp/mylog.log'

    ...for whatever reason when you pass a file in this format to File.Exists(..) its coming back with false.
    Mick Lang
    Tuesday, March 31, 2009 5:41 AM
  • Thanks Yunwen, I tried changing the contents as you've instructed, however, it still doesn't appear to work. 

    I believe it simply doesn't work, there is code there that looks like it should produce a sync trace, but there's a bug that ensures it never does.  If there's anyone at Microsoft who can change the code, I believe the problem lies in the path to the file being passed to File.Exists as a Uri

    e.g 'file:///program files/myapp/mylog.log'

    ...for whatever reason when you pass a file in this format to File.Exists(..) its coming back with false.
    Mick Lang

     

    HI Mick,

    I have make a try follow Yunwen's mention, it can be work under my device.

    And there are 2 extra points that you need to take care:

     

    1.      Make sure file "trace.config.txt" has put in your application folder on device. You may create a file named "trace.config.txt" and add to your VS solution, the VS will automatic generate this file within your app folder when you deploy App.

    2.      If you are not specify a log file path, the log will by default generate in ROOT path under device. Please take a look.

     

    Share out my trace.config.txt:

     

    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>

    <traceSettings>

    <add key ="FileLocation" value="Trace_OCS.txt"/>

    <add key ="LogLevel" value="1"/>

    </traceSettings>

    </configuration>

     

    If still not work, please tell me your build version of Sync Service for ado.net, thanks.

     


    Joey Liang
    Your potential our passion This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, April 1, 2009 3:59 AM