Select to view content in your preferred language

Map Crash - version 10.1.1

1073
1
07-16-2013 12:35 PM
KierenTinning1
Deactivated User
Strange issue with 10.1.1

When downloading data using code which worked just fine in 10, the MobileCache is left in a valid state, but if one clicks the ViewMapTask ArcGIS Mobile crashes (no log file, etc). If you open Mobile again and open the map everything works fantastically well.

Only ever happens after a download (and it is consistent) Code is blow, any thoughts would be greatly appreciated

private void btnGetData_Click_1(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            QueryFilter qf = MakeCacheQuery();
            IEnumerable<MobileCacheMapLayerInfo> emi = MobileApplication.Current.Project.EnumerateMobileCacheMapLayerInfos();

            foreach (MobileCacheMapLayerInfo mi in emi)
            {
                MobileCache mc = new MobileCache(mi.MobileCache.StoragePath);
                if (mc.CacheExists && mc.IsOpen)
                    mc.Close();

                try
                {
                    var con = new MobileServiceConnection();
                    con.Url = mi.MobileServiceConnection.Url;
                    con.CreateCache(mc);
                    mc.Open();
                    ICollection<FeatureSource> fSources = mc.FeatureSources;

                    foreach (FeatureSource fs in fSources)
                    {
                        try
                        {
                            fSyncAgent = new FeatureSyncAgent(fs, con);
                            fSyncAgent.SynchronizationDirection = SyncDirection.DownloadOnly;
                            fSyncAgent.DownloadFilter = qf;
                            //fSyncAgent.StateChanged += new EventHandler(fSyncAgent_StateChanged);
                            SyncResults sr = fSyncAgent.Synchronize();

                            //if (sr.DataSizeReceived == 0)
                            //{
                            //    System.Threading.Thread.Sleep(500);
                            //    fSyncAgent.Synchronize();
                            //}
                            //Application.DoEvents();
                        }
                        finally
                        {
                            //fSyncAgent.StateChanged -= new EventHandler(fSyncAgent_StateChanged);
                            fSyncAgent = null;
                        }
                    }

                }
                finally
                {
                    if (mc != null && mc.CacheExists && mc.IsOpen)
                    {
                        mc.Close();
                        //mc.Open();
                    }

                }

            }
            Cursor.Current = Cursors.Default;
            MobileApplication.Current.Transition(MobileApplication.Current.Project.SelectTaskPage);
        }
0 Kudos
1 Reply
KierenTinning1
Deactivated User
Does anyone have any thoughts on this? I have tested the Mobile Cache with the IsValid method and it always returns true.

Thanks,

K
0 Kudos