c# - UnauthorizedAccessException in Vista from frequent file I/O with .Net 2.0 -
At work, we migrated from Windows XP to Windows Vista. After the migration, some of the unit tests, using NUNIT, randomly failed with the system. Exploring unauthorized access access. After being included in unsuccessful tests, Test DLL, which runs in trial, contains files used for trials submitted as embedded resources, then removal of them, usually Setup / Teadown or Stability Setup / fast succession in TeDown In. I do this so that my tests are agnostic for every developer's place on the drive and they are not concerned about the relative file path.
While troubleshooting this, I came to know that it is related to creation and deletion, when the files are removed, each deleted pattern is as follows:
File.Delete (path)} When I circle an attempt to catch it, with catch-blocks and breakpoints (if exception was thrown), The file will be deleted from the disk beforehand. For file creation failures, typically using XMLReeter or Streimerator, each file is specified for overwriting. Strange thing, while investigating, I have created this C # program to recreate the exception:
class program {static zero main (string [ ] Args) {int i = 0; Try {while (true) {System.IO.TextWriter author = new system.IO.StreamWriter ("file.txt"); I ++; System.Console.Out.WriteLine (i); Writer.Write (i); Writer.Close (); System.IO.File.Delete ("file.txt"); }} Catch (system unauthorized access to access) {System.Console.Out.WriteLine ("Boom:" + i.ToString ()); }}}
On one of our machines, which still has XP, without killing it till it hits me, then again, without hundreds of thousands of thousands it has to be again. On any of our Vista machines, it will print "Boom" anywhere between 150 and 500 iterations.
I do not have access to Vista machine outside of work, so I can not determine that this particular '
edit:
edit Do:
I like it to thank everyone for your responses I used the procedure suggested by Christian to monitor and found that my code was going on as suggested by Martin, while Windows Vista SearchIndexer and Tortoise SNN TSVNCache type Procedures were trying to reach the target file.
Thanks again
Do you have any virus scanners? Try to deactivate them or view file activity from ProcMon from
Comments
Post a Comment