Skip to content

Crash when saving from multiple copies of an application #1

@njcrawford

Description

@njcrawford

This was originally opened as njcrawford/EmbroideryReader#18, but it's actually a bug in IniFile.

When several copies of an application are opened, and they all try to save settings on close, and the user does "Close this group" from the taskbar, all copies try to write to the settings file at the same time and crash.

Example crash log, taken from Embroidery Reader issue 18:
Time: 2016-11-14 12:09:03
Program: embroideryReader, Version=2.2.3.0, Culture=neutral,
PublicKeyToken=null
Program location: C:\Program Files (x86)\NJCrawford
Software\Embroidery Reader\embroideryReader.exe
OS: Windows 10 Home release 1607 (6.3 build 14393) (x64)
OS Culture: en-US
Framework: 4.0.30319.42000 (x64)

Error:
System.IO.IOException (The process cannot access the file
'C:\Users[username]\AppData\Local\NJCrawford Software\Embroidery
Reader\embroideryreader.ini' because it is being used by another
process.)
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String
destFileName, Boolean overwrite, Boolean checkHost)
at NJCrawford.IniFile.save()
at embroideryReader.frmMain.Form1_FormClosing(Object sender,
FormClosingEventArgs e)
at System.Windows.Forms.Form.OnFormClosing(FormClosingEventArgs e)
at System.Windows.Forms.Form.WmClose(Message& m)
at embroideryReader.frmMain.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions