I'm working on a Windows Service that watches a few folders for changes, creations, and deletions. It all works well with the exception of one watcher that watches a single file (XML File with Configuration Settings) for minor changes.
I tried taking the Windows Service code and putting it into a simple windows application with start/stop buttons for the filesystem watchers and stepped through it. It never detects the file change of the XML config file. The changes are indeed occurring and the "Date Modified" of the file is updating.
XmlEventReferences = New System.IO.FileSystemWatcher()
XmlEventReferences.Path = "C:\XmlReferences\"
XmlEventReferences.Filter = "*.xml"
XmlEventReferences.NotifyFilter = IO.NotifyFilters.FileName
AddHandler XmlEventReferences.Changed, AddressOf ReloadEventReferences
AddHandler XmlEventReferences.Created, AddressOf ReloadEventReferences
AddHandler XmlEventReferences., AddressOf ReloadEventReferences
XmlEventReferences.EnableRaisingEvents = True
That was some of the code and this is a sample of the XML File:
<EventReference>
<ER_EL_NUMBER>1</ER_EL_NUMBER>
<ER_SEND_TO_DATABASE>true</ER_SEND_TO_DATABASE>
<ER_ACTIVATE_ALARM>true</ER_ACTIVATE_ALARM>
<ER_DESCRIPTION />
</EventReference>