Exception on ReadAsync() (RadMap control)

6 posts, 0 answers
  1. טלי
    טלי avatar
    2 posts
    Member since:
    Oct 2017

    Posted 23 Oct Link to this post

    Hi,

    We are using the RadMap control (v. 4.0.30319) in a MVVM WPF project .

    In some cases we encounter an exception on the AsyncShapeFileReader while calling ReadAsync()

    Exception Message: collection was modified; enumeration operation may not execute

    Telerik.windows.controls.Map.MapShapeDataVirtualizationSource.QueryItems ( line 440)

    I thought it was a cross-threading problem and inserted some changes in my code :

    - calling this.Dispatcher.Invoke((Action)(() => AsyncShapeFileReaderObj. ReadAsync() ));       

    - using async/ await

    but both changes did not solved the problem and the exception still rize.

    what could be the problem? Do you have another idea how can i solved it? 

    The Main thread is calling the ReadAsync() and the other threads that i could see are background workers of Telerik's Map ...

    Thanks,

    Tali

     

     

     

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2997 posts

    Posted 25 Oct Link to this post

    Hi Tali,

    Could you please double check your application if it uses any background workers or parallel code ? We have a single similar report for the same exception in the QueryItems method (reproted once in 2014):

    private void QueryItems(object state)
            {
                MapItemsRequestEventArgs e = state as MapItemsRequestEventArgs;
     
                var query = from ExtendedDataProvider item in this.InternalCache
                            where MapShapeDataVirtualizationSource.ShouldBeAdded(e.Region, item, e.MinZoom, this.Resolution)
                            select item;
     
                var shapes = query.ToList();
     
                e.CompleteItemsRequest(shapes);
            }

    Our client built the source code of the RadMap locally and added a lock:
    private void QueryItems(object state)
            {
                MapItemsRequestEventArgs e = state as MapItemsRequestEventArgs;
      
                var query = from ExtendedDataProvider item in this.InternalCache
                            where MapShapeDataVirtualizationSource.ShouldBeAdded(e.Region, item, e.MinZoom, this.Resolution)
                            select item;
     ///put a lock here
    lock ((this.InternalCache as ICollection).SynchRoot)
    {
                var shapes = query.ToList()
    }
      
                e.CompleteItemsRequest(shapes);
            }

    ......
    In other method:
    lock ((this.ShapeVirtualSource.InternalCache as ICollection).SynchRoot)
    {
    this.ShapeReader.Source = readRequest.Shapes;
    this.ShapeReader.ReadAsync(readRequest.OnCompleted);
    }



    Regards,
    Petar Mladenov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. טלי
    טלי avatar
    2 posts
    Member since:
    Oct 2017

    Posted 13 Nov in reply to Petar Mladenov Link to this post

    Petar, Thanks for your reply !

    I did the changes you recommended locally in the Telerik's Map control source code,

    but i am having some compilation error while building the DataVisualization_WPF's  solution:

    - On the GenericModern_x.xaml : I got an error description of "The tag 'ModernColors' does not exist in XML namespace..."

    - On the Map_Buttons_Office2013_Style.xaml : I got an error description of "The type reference cannot find a public type named 'RadButton'"

    The RadControls source code files that we have are of version 2013_3_1316 .
    When i replaced the Telerik's dlls reference  to the ones of the 2014 version (2014_2_0721) i got other errors...
    How can i fix those errors in order to reproduce the new fixed Telerik's dlls?

    Where can i find some documentation about manually updating the Telerik's dlls ?
    Thanks in advance for your support!

    Regards,

    Tali

     

  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2997 posts

    Posted 15 Nov Link to this post

    Hello Tali,

    Please refer to your Telerik UI for WPF installation folder and find ReadMe.rtf file which contains list of steps / instructions for building the source code. Also they refer files from Build\\BuildInstructions folder - so navigate to it too, to find detailed rtf files for every step / instruction. 

    Regards,
    Petar Mladenov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  5. Hila
    Hila avatar
    17 posts
    Member since:
    Dec 2013

    Posted 5 days and 4 hours ago in reply to Petar Mladenov Link to this post

    Hi Petar,

    We have downloaded a new version of Telerik's product - version 2015_1_0401
    and changed your source code as recommended (and as described on the BuildInstructions files) in order to solve the exception that arise in our system as a result the rad map using.
    we built your dll as needed - the control+data as well as the other controls that are used in our system
    but after we replaced the old telerik' dlls with the new one
    our system compiled ok and started to run but on beginning of run time some XamlParseException exceptions were thrown.
    Our application run OK with the old telerik's dll but with the updated version we have a lot of problems 
    and we did not succeeded to make our application run again.
    We deleted the bin/obj directories, restarted th Visual Studio, did some clean and rebuild again and again,
    even deleted the project's .suo file but unfortunately nothing seems to work.
    What should we do in order to make things working??
    Thanks,
    Tali   

  6. Stefan
    Admin
    Stefan avatar
    805 posts

    Posted 1 day and 6 hours ago Link to this post

    Hello Hila,

    Generally, in case the XamlParseExceptions are raised for a given assembly, most probably the binaries are not with the same version. Can you please double check this? Also, can you also verify that there aren't references added to both standard and NoXAML binaries?

    Best Regards,
    Stefan
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top