1

https://github.com/Esri/arcgis-runtime-samples-dotnet samples I am exploring the xamarin samples that are available through the link above. One sample that is called Generate geodatabase here shows how to generate a geodatabase and store it locally on the device.

Problem: I am running the sample for UWP app and it breaks showing this. System.IO.FileLoadException: 'File exception: The supplied file path contains directories that do not exist.' I have investigated the issue and here are my findings: The file path "_gdbPath" supplied to

_generateGdbJob = _gdbSyncTask.GenerateGeodatabase(generateParams, _gdbPath);

is obtained using the following method:

private string GetGdbPath()
        {
            // Set the platform-specific path for storing the geodatabase
            String folder = "";

#if NETFX_CORE //UWP
            folder = Windows.Storage.ApplicationData.Current.LocalFolder.Path.ToString();
#elif __IOS__
            folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
#elif __ANDROID__
            folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
#endif
            // Set the final path
            return Path.Combine(folder, "wildfire.geodatabase");

    }

Now, the GbdPath location is on the devise and it is correct. I physically went opening the path and also I have tried creating a file in the path/folder like the following:

async void WriteTimestamp()
        {
            Windows.Globalization.DateTimeFormatting.DateTimeFormatter formatter =
                new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("longtime");

           StorageFile sampleFile = await localFolder.CreateFileAsync("wildfire.geodatabase",
                CreationCollisionOption.ReplaceExisting);
           await FileIO.WriteTextAsync(sampleFile, formatter.Format(DateTime.Now));
        }

It worked and the file was successfully created. So, the file system is accessible. Also, I tried it on Android with a little modification/change, I made it work here the change.

Question: What's wrong with UWP platform in my case (I have not tested IOS)?

Update:

I have done further research and found that there might be a bug (that I will report) in GeodatabaseSyncTask class GenerateGeodatabase method. It cannot find the LocalState folder in case of Windows 10 configured to store new content in another location (other than on default c: drive) like in my case see here . So, if windows 10 is configured to store app content on another drive (like in my case) the class mentioned above cannot see it (based on observation only, I did not decompile it). Windows 10 stores the content on another drive in WpSystem... folder. System will create a shortcut called LocalState junction, if you explore the default location using command prompt cmd, that point to the custom location.

I do not know what would be the best work around till it is fixed.

armyllc
  • 157
  • 1
  • 6
  • Works for me just fine, perhaps there's something off with your setup? I used Visual Studio 2017 15.3.5 with Xamarin 4.7.9.45 and it works on Windows 10 (desktop) 1703 compilation 15063.608 – orhtej2 Oct 06 '17 at 19:39
  • I am running it for x86 platform and am using Xamarin 4.7.9.45,Windows 10 Pro (desktop) as well. – armyllc Oct 06 '17 at 19:47
  • So am I, hence it's most likely not a setup issue. Sorry, can't help you then. – orhtej2 Oct 06 '17 at 19:49
  • Borrowing your machine will solve the problem :). – armyllc Oct 06 '17 at 19:51

0 Answers0