-1
[ 10,13136] 2017-10-23T11:53:31 - -------------------- IOException caught --------------------
[ 10,13136] 2017-10-23T11:53:31 - The process cannot access the file 'C:\Users\cdahal\AppData\Roaming\Skype\chetan.d\config.xml' because it is being used by another process.
[ 10,13136] 2017-10-23T11:53:31 - Stack trace is : 
[ 10,13136] 2017-10-23T11:53:31 -    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
   at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)
   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)

Every time the Accessibility option in Skype is updated, it changes its config.xml file. We currently read values from the node /config/UI/General/Accessibility, however when my application and skype both are running and I make changes to the Accessibility option, I get the following error message:-

Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
C.D
  • 1
  • 2
  • 1
    so you're trying to update skypes config, while its running and are surprised that its locking its config file? – BugFinder Nov 02 '17 at 09:01
  • What is your question? Simply put, if Skype has the file open and locked you cannot modify it. – Lasse V. Karlsen Nov 02 '17 at 09:06
  • Well, I am trying to read the updated values. Possible solutions would be copying the config.xml file to a temp location and trying to access. Was wondering if there might be any other solutions to it.. – C.D Nov 02 '17 at 09:08
  • 1
    Youve got no code here - how are you opening the file to read values? – BugFinder Nov 02 '17 at 09:10
  • Are you using FileShare.Read and FIleAccess.Read when you open the file? Post your file opening code! – Polyfun Nov 02 '17 at 09:16
  • XmlNode node = doc.DocumentElement.SelectSingleNode("/config/UI/General/Accessibility"); – C.D Nov 02 '17 at 09:26

1 Answers1

0

You don't say it, but I infer you are using XmlDocument.Load to load the file. You should try loading the document from a stream that has been opened with FileAccess.Read and FileShare.Read. This is a duplicate of c# xml.Load() locking file on disk causing errors.

Polyfun
  • 9,479
  • 4
  • 31
  • 39