System.Exception:未找到形状文件:[PATH]

System.Exception: Shape file not found: [PATH]

调用此方法时,当它到达 OpenAsync() 时我得到以下堆栈跟踪:

System.Exception: Shape file not found: C:\Users\Laura\Desktop\shapes\TOTALMAP\OH_Line_6600v_Expired.shp at RuntimeCoreNet.Interop.HandleException(Boolean retVal) at RuntimeCoreNet.CoreFeatureSource.FromShapefile(String filename) at Esri.ArcGISRuntime.Data.ShapefileTable.OpenAsync(String filename)
at ShapeSQLiteGISDemo.MainPage.d__3.MoveNext()

我在同一个文件夹中有一个同名的 .dbf 和 .shx 文件,我 运行 Visual Studio 处于管理员模式。

private async void ImportShapes(object sender, RoutedEventArgs e)
    {
        try
        {
            //Get path from file picker
            var picker = new FileOpenPicker { SuggestedStartLocation = PickerLocationId.Desktop };
            picker.FileTypeFilter.Clear();
            picker.FileTypeFilter.Add(".shp");
            var file = await picker.PickSingleFileAsync();

            //convert folder contents to a ShapefileTable
            var shapefile = await ShapefileTable.OpenAsync(file.Path);

            //save object to database
            _DatabaseConnection.Insert(shapefile);
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex);
        }

        //call a method that loads shapes from the database
        LoadDatabaseOntoMap();
    }

非常感谢任何帮助。

尝试使用记事本等应用通过粘贴路径打开文件:

C:\Users\Laura\Desktop\shapes\TOTALMAP\OH_Line_6600v_Expired.shp

应用程序是否打开文件?

还有其他可以打开的形状文件示例吗?这个文件可能只是损坏了吗?

我认为问题在于应用商店和 UWP 应用程序必须先将 .shp 文件移动到本地存储中的文件夹,然后应用程序才能打开它。

如果这能解决问题,将设置为已接受的答案。

编辑:确实如此,因为我使用文件选择器选择了一个文件,我只能访问该文件。为了获取多个文件,我使用了文件夹选择器并过滤掉了所有无用的文件。