This project is read-only.

DotSpatial app never exits when has SHP layer

Jul 30, 2014 at 1:36 AM
Hi! I'm using dotSpatial to display shapefile over brutile layer in my WPF application.
Everything works good, but if I close the application it never exits and just hangs.
It happens if my shapefile (shp+dbf) is about 8MB. If I'm loading small file (50-100KB) then the app exits good. Also If I don't add shapefile into Map control (but still open the shapefile) everything works good.
My code:
  /// <summary>
  /// Interaction logic for MainWindow.xaml
  /// </summary>
  public partial class MainWindow : Window
    public MainWindow()
      var map = (Map)FormsHost.Child;
      var pathNoExt = "shapefile";

      var featureSet = FeatureSet.OpenFile(pathNoExt + ".shp");
      featureSet.Projection = ProjectionInfo.FromEsriString(File.ReadAllText(pathNoExt + ".prj"));
      map.ProjectionModeDefine = ActionMode.Never;
      map.ProjectionModeReproject = ActionMode.Never;
      var bingAerialLayer = new BruTileLayer(new BingLayerConfiguration("cache", BingMapType.Aerial));
      map.CollisionDetection = true;
      // !!! if comment this line, the app exits normally
      map.FunctionMode = FunctionMode.Pan;
      map.ViewExtents = featureSet.Extent;
      map.Projection = bingAerialLayer.Projection;

<Window x:Class="DotSpatialSample1.MainWindow"
        Title="MainWindow" Height="350" Width="525">
        <WindowsFormsHost x:Name="FormsHost">
You can look at Parallel stacks windows in VS after I click Close in my app here
Will be glad for any help.
Jul 30, 2014 at 9:06 AM
i'm not sure that this is somehow depends on shapefile size. It may depends from WPF\WinForms.
WPF WindowsFormsHost usually works slow and potentially can hang up applicaton. The better use WinForms applicaiton.
Jul 30, 2014 at 12:40 PM
Winforms in 2014 - really bad approach)
It's strange that it happens only if I add this layer into map, so I guess there is some dependency on shapefile.