none
Why do i get this ArgumentException when adding ScopeParameter RRS feed

  • Question

  • I have a Web Applicatio, I've created a Service file for Sync, Its Sync Framework CTP 4.0 October

     

    I have a client on Windows Phone 7

     

    Server Code :

     

    public class ForumSyncService : Microsoft.Synchronization.Services.SyncService<ForumOfflineEntities> 
        {
            
            public static void InitializeService(Microsoft.Synchronization.Services.ISyncServiceConfiguration config) 
            {
                config.ServerConnectionString = NutriLeaf.Services.Constants.Settings.ServerDbConnectionString;
                config.SetEnableScope("ForumScope");
                config.SetDefaultSyncSerializationFormat(Microsoft.Synchronization.Services.SyncSerializationFormat.ODataJson);
                config.SetConflictResolutionPolicy(Microsoft.Synchronization.Services.ConflictResolutionPolicy.ClientWins);
                config.EnableDiagnosticPage = true;
                config.UseVerboseErrors = true;
                config.AddFilterParameterConfiguration("UserID", "ForumThreads", "@UserID", typeof(int));
                config.AddFilterParameterConfiguration("UserID", "ForumThreadReplies", "@UserID", typeof(int));
            }
        }
        #endregion
    


     

    Client Code

     

    static ForumSync.ForumOfflineContext ForumContext = new ForumSync.ForumOfflineContext(Constants.SyncCache.Forums, new Uri(Constants.SyncServices.Forums));
            public static void SyncForums()
            {
                if (UserID == "" || UserID == "0")
                {
                    throw new ArgumentNullException("UserID in setting file not found");
                }
    
                ForumContext.CacheController.ControllerBehavior.AddScopeParameters("UserID", "123"); //exception here
                ForumContext.CacheController.ControllerBehavior.SerializationFormat = Microsoft.Synchronization.ClientServices.SerializationFormat.ODataJSON;
                ForumContext.LoadCompleted += new EventHandler<Microsoft.Synchronization.ClientServices.IsolatedStorage.LoadCompletedEventArgs>(ForumContext_LoadCompleted);
                ForumContext.LoadAsync();
            }
    


    I get ArgumentException : Value doesnot fall within expected range!

     

    Stack Trace

     

       at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)

       at System.Collections.Generic.Dictionary`2.Insert(String key, String value, Boolean add)

       at System.Collections.Generic.Dictionary`2.Add(String key, String value)

       at Microsoft.Synchronization.ClientServices.CacheControllerBehavior.AddScopeParameters(String key, String value)

       at NutriLeaf.Phone.Sync.NutriLeafSync.SyncForums()

       at NutriLeaf.Phone.Pages.Sync.Sync.NutriLeafSync_ArticleSyncCompleted(Object sender, EventArgs e)

       at NutriLeaf.Phone.Sync.NutriLeafSync.CacheController_ArticleRefreshCompleted(Object sender, RefreshCompletedEventArgs e)

       at Microsoft.Synchronization.ClientServices.CacheController.FireRefreshCompletedEvent(Exception error, Boolean wasCancelled)

       at Microsoft.Synchronization.ClientServices.CacheController.RefreshWorkerCompleted(Object error)

       at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ThreadPool.WorkItem.doWork(Object o)

       at System.Threading.Timer.ring()

     

     

     

     

    PLEASE HELP!!! 

     

    Thank you for your Help!


    Nawaz Dhandala
    Wednesday, November 16, 2011 2:45 PM

Answers

  • Sorry, My Mistake... I called a refresh event of a different object!.. Sorry for this and thank you for your help!
    Nawaz Dhandala
    • Marked as answer by Nawaz Dhandala Wednesday, November 16, 2011 2:52 PM
    Wednesday, November 16, 2011 2:52 PM