Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

How to invalidate the cache used by XDocument.Load?

$
0
0

I'm writing a WPF application. The app will run a series of unit tests against some files. The details as to which files and expected results, etc. are in an XML file. I load it with XDocument.Load(_myFileName) every time I click the RunTests button. But if I change the file between runs, the changes are not detected. It seems that XDocument is not detecting the change to the file and is relying on its cached data. How can I force XDocument to re-read the file from disk? Or invalidate the cache so it refreshes from disk?

I see a few posts on this, but they seems to be web based and suggest using http headers to set a caching parameter.  I'm not web based, so even if this works, it's no good for me.

I also saw something about using a memorycache manager: https://msdn.microsoft.com/en-us/library/system.runtime.caching.memorycache.aspx but I can't quite figure out how this would relate to the XDocument...

Any thought on how to force the data refresh are appreciated...

Thanks.

J


http://digitalcamel.blogspot.com/


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>