Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

FileChangeWatcher blocks application on start-up

$
0
0

I am trying to port the FileWatcher feature from #SharpDevelop into a WPF application and thought this
should not be complex if I start adopting the model part and build the viewmodel on it etc...

https://edi.codeplex.com/SourceControl/latest#Edi.Core/Utillities/FileSystem/PathName.cs

and this seemed to be a good approach but I found now that the application is sometimes hanging
on start-up - this problem seems somehow to be due to the FileChangeWatcher class

https://edi.codeplex.com/SourceControl/latest#Edi.Core/Utillities/FileSystem/FileChangeWatcher.cs

...because I never ran into this before but it appeared right after integrating this... The deadlock is so

bad that I have to re-boot my PC to get rid of the hanging process... and it does not allways happen -
but it does occur 1 out of 10 times when I have about 10 files open from different locations (network,
hard disk drives etc).

So, it looks like I am looking at another threading problem but I cannot seem to be able to resolve it
(I already spent a day on it).

The problem can be verified when the code in
Edi.Core.Models.Documents.DocumentModel.QueryFileProperies():

https://edi.codeplex.com/SourceControl/latest#Edi.Core/Models/Documents/DocumentModel.cs

---------------

if (this.mFileChangeWatcher != null)
{
  this.mFileChangeWatcher.Dispose();
  this.mFileChangeWatcher = null;
}

this.mFileChangeWatcher = new FileChangeWatcher(this);
---------------

is commented in to activate the FileChangeWatcher and the application is started with a document session
that has a few documents to be opened on start-up (open application, open multiple documents, shut-down
application, re-start application).

My problem in WPF is that I am opening the file on a background thread and I think this is part of the problem
I just cannot find a concept to ensure the correct thread access because the application either hangs or the
FileChangeWatcher is just not working :-(

Does someone have an idea to tackle this with a sound concept in WPF?


Viewing all articles
Browse latest Browse all 1764

Trending Articles