Hello,
I'm working on basemap control in a Xamarin Forms app targeting UWP. I am using v100.4.0. The app has the ability to load any .vtpk's and .tpk's that are in the device's My Documents folder. I want the user to be able to remove any of these .vtpk or .tpk files from the app if they would like too.
I'm currently able to add/remove any .tpk's. I am also able to load and delete .vtpk's, but only as long as I don't turn that basemap on. It seems that once I load a vector tile layer, the file stays locked in memory. I have tried turning on a .vtpk and then switching to another basemap, but I still cannot delete the file. I am getting a System.IO.IOException saying "The process cannot access the file xxx.vtpk because it is being used by another process"
Again, I am able to load a .tpk file, turn it on and off, then delete it with no problem. It just gives me that error if I try to delete a .vtpk once I have turned it on.
Any ideas on how to remove the vector tile layer from memory once I have switched to another basemap? Thanks.
I have the same problem in the ArcGis Runtime SDK for .NET v100.6
I am also facing the same issue. Did you get any solution for this?
Sometimes the garbage collector can get a little lazy on cleaning up. Try forcing a GC prior to deleting:
GC.Collect();
GC.WaitForPendingFinalizers();
Thanks Morten I did that . Put above GC force deletion code above deleting the .vtpk file but it is still giving same error.
Make sure all references to the layer is completely out of scope (no live variables pointing to it directly or indirectly), or the GC has no effect.
Hi Kavita, I haven't found a solution to this yet, unfortunately.