 <pre><code>try this if your's application is only access that .xml file 1. Create a Object globally object lockData = new object(); 2.Use than object to lock statement where you save and load xml lock(lockData ) { doc.Load("test.xml"); } lock(lockData ) { doc.Save("test.xml"); } </code></pre>