c# - StreamWriter not releasing lock on a file even when including within Using clause -


i using c#.net code copy file containing xml data location on linux server. after copy file call third party (java app) web-service tries consume file copied. third party service first tries rename file , in process getting issue -java file.renameto method returns false. suggests file still being used/open other process.

the stream write code given below

using (streamwriter file = new streamwriter(filename) {     file.writeline(xml);     file.close(); } // code calls web service follows 

the file copied may huge in size (20-30 mb in cases). there way can confirm file has been copied location , no process holding on file before call third party service. sure there not other process holding on other 1 copying file.

try perform

file.close(); file.dispose();

that works me.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -