Bugzilla – Bug 324670
Sharing violation of header template
Last modified: 2007-09-15 21:23:51 UTC
---- Reported by antti.oja@gmail.com 2007-07-03 03:10:03 MST ---- Please fill in this template when reporting a bug, unless you know what you are doing. Description of Problem: MonoDevelop 0.14 produces an exception exclaiming a sharing violation when you've created a new file and try to edit the header template without saving the newly-created file. Steps to reproduce the problem: 1. Open up MonoDevelop 2. Select New from the File menu and create any new C# source file that would get the header template. 3. Do not save the file, but go to preferences and edit the header template and hit ok. 4. An exception gets thrown. Actual Results: An exception gets cast. MonoDevelop will keep working though, so this is not fatal. Expected Results: MonoDevelop to quietly alter the template, but not tamper with the newly created file. How often does this happen? Always repetitible. Additional Information: Complete exception report: Exception occurred: Sharing violation on path /home/antti/.config/MonoDevelop/StandardHeader.xml System.IO.IOException: Sharing violation on path /home/antti/.config/MonoDevelop/StandardHeader.xml at System.IO.FileStream..ctor (System.String name, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] at System.IO.FileStream..ctor (System.String name, FileMode mode, FileAccess access, FileShare share) [0x00000] at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) [0x00000] at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding) [0x00000] at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool,System.Text.Encoding) at System.Xml.XmlWriter.Create (System.String file, System.Xml.XmlWriterSettings settings) [0x00000] at System.Xml.XmlWriter.Create (System.String file) [0x00000] at MonoDevelop.Ide.StandardHeaders.StandardHeaderService.Save (System.String fileName) [0x00000] at MonoDevelop.Ide.StandardHeaders.StandardHeaderService.set_Header (System.String value) [0x00000] at MonoDevelop.Ide.StandardHeaders.StandardHeaderPanel+StandardHeaderWidget.Store () [0x00000] at MonoDevelop.Ide.StandardHeaders.StandardHeaderPanel.StorePanelContents () [0x00000] at MonoDevelop.Core.Gui.Dialogs.AbstractOptionPanel.ReceiveDialogMessage (DialogMessage message) [0x00000] ---- Additional Comments From mkrueger@novell.com 2007-07-11 05:03:18 MST ---- Seems that the XmlTextWriter.Close method doesn't close the underlying stream. Using an own FileStream and closing this manually after the XmlTextWriter.Close method fixes this bug. Unknown bug field "cf_op_sys_details" encountered while moving bug <cf_op_sys_details>Gentoo Linux /w 2.6.20-r8 kernel, i686 AMD Athlon(tm) 64 Processor 3500+ AuthenticAMD GNU/Linux</cf_op_sys_details> Unknown operating system unknown. Setting to default OS "Other".