Browse Source

Ignore IOException when saving layout (maybe another process is writing to the layout file).

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5436 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Daniel Grunwald 16 years ago
parent
commit
d67005fa0f
  1. 5
      src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataSessionWriter.cs
  2. 5
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonDockLayout.cs

5
src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataSessionWriter.cs

@ -303,9 +303,8 @@ namespace ICSharpCode.UsageDataCollector
static string GetTypeName(Exception exception) static string GetTypeName(Exception exception)
{ {
string type = exception.GetType().FullName; string type = exception.GetType().FullName;
ExternalException ee = exception as ExternalException; if (exception is ExternalException || exception is System.IO.IOException)
if (ee != null) return type + " (" + Marshal.GetHRForException(ee).ToString("x8") + ")";
return type + " (ErrorCode " + ee.ErrorCode.ToString("x8") + ")";
else else
return type; return type;
} }

5
src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonDockLayout.cs

@ -309,7 +309,12 @@ namespace ICSharpCode.SharpDevelop.Gui
Directory.CreateDirectory(configPath); Directory.CreateDirectory(configPath);
string fileName = Path.Combine(configPath, current.FileName); string fileName = Path.Combine(configPath, current.FileName);
LoggingService.Info("Saving layout file: " + fileName); LoggingService.Info("Saving layout file: " + fileName);
try {
dockingManager.SaveLayout(fileName); dockingManager.SaveLayout(fileName);
} catch (IOException ex) {
// ignore IO errors (maybe switching layout in two SharpDevelop instances at once?)
LoggingService.Warn(ex);
}
} }
} catch (Exception e) { } catch (Exception e) {
MessageService.ShowException(e); MessageService.ShowException(e);

Loading…
Cancel
Save