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.