In my code I am trying to read a file using File.Open()
with relative path. But some times the current directory is getting changed and directory not found exception is coming.
I am trying to figure out where is Environment.CurrentDirectory
is getting changed. I checked the Directory.SetCurrentDirectory method but its calling to native method.
Is there any event which will notify me when Environment.CurrentDirectory
has changed? How do I find out where exactly is directory changed?
I have tried putting break point in all occurrence of Environment.CurrentDirectory
and Directory.SetCurrentDirectory()
.