File being used by another process
hello, i have multi-threaded program several threads can call static method in static class. code use follows: string connection = null; lock (threadlock) { streamreader sr = null; try { sr = new streamreader(path); connection = sr.readtoend(); sr.close(); sr.dispose(); } catch (exception e) { debug.writeline("there exception accessing file " + path + ":" + e.message); debug.writeline(e.stacktrace); sr.close(); } } the problem streamreader not seem closing file. following exception: a first chance exception of type 'system.io.ioexception' occurred in mscorlib.dll there exception accessing file c:\test installa...