I have a problem with this code:
if (_updater.IsNewVersionAvailable())
{
_isolatedStorageFile.CreateDirectory("Folder");
_isolatedStorageFile.CreateDirectory("Folder2");
foreach (string file in Directory.GetFiles(_sharedFilesFolder + "\\Folder"))
{
string fileName = Path.GetFileName(file);
//_isolatedStorageFile.CreateFile(fileName); // <- same problem
using (var outputStream = _isolatedStorageFile.OpenFile("Folder/" + fileName, FileMode.Create, FileAccess.Write)) // <- here is the problem (I tried with backslash (\\) and also doesnt work.
{
using (var inputStream = File.OpenRead(file))
{
inputStream.CopyTo(outputStream);
}
}
}
}
When I run the MS Test which called this piece of code I get this error:
The folders inside isolated storage are created normally ( I cannot create a file) The strangest thing is that once when I started the test the file has been created - it was 1/20 runs.
Any idea?
One thing you can try is, insert this in your code right before you're getting the infinite recursion issue (from here and here):
try
{
throw new NotImplementedException();
}
catch (NotImplementedException ex)
{
}
I was just trying to figure out an issue where we intended to retrieve something from isolated storage, and it got stuck in this inf recursion. I was browsing the .Net and MSTest sources, and it seems that:
The NotImplementedException or AgrumentException seems to force mscorlib to be loaded, and the loop is avoided. Maybe there's a another way of making it easier to find, though.