mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Catch exceptions when writing files in ImageFileCache
This commit is contained in:
parent
d055d737ed
commit
5760471c1c
|
|
@ -171,11 +171,19 @@ namespace Caching
|
|||
if (extension != null)
|
||||
{
|
||||
var path = GetPath(key) + extension;
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
using (FileStream fileStream = new FileStream(path, FileMode.Create))
|
||||
try
|
||||
{
|
||||
fileStream.Write(buffer, 8, buffer.Length - 8);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
using (FileStream fileStream = new FileStream(path, FileMode.Create))
|
||||
{
|
||||
fileStream.Write(buffer, 8, buffer.Length - 8);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Trace.TraceWarning("ImageFileCache: Writing file {0} failed: {1}", path, ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue