I want to know if there exist and tool in visual studio (or plugin) that can be used to locate FileStream variable that not are closed.
Background
I was assigned to write code to a existing application. The code I was working on worked fine then when I used it together with the existing code. I got
IOException
The process cannot access the file ‘[Filepath]’ because
it is being used by another process.
I have no idea were code is that cause this that is why I’m asking if a tool like this exist.
Code Analysis in Visual Studio Ultimate or Professinal includes a rule to detect that both local variables that are disposable (like
FileStream) are disposed of before going out of scope (http://msdn.microsoft.com/en-us/library/ms182289.aspx) as well as a rule to make sure types that have disposable fields are also disposable (http://msdn.microsoft.com/en-us/library/ms182172.aspx)Neither of which will really do anything detect whether another process has a file in use.