.tmp file handle issue causing exception in WinSCPnet!WinSCP.SessionLogReader.OpenLog()
WinSCP automation 5.7.5 (need .NET 4.5.2)
Issue:
Exceptions occur randomly which seems to be related to how WinSCP handle .tmp file handles internally.
Is this a known issue? Can you handle this in another way? (with .NET 4.5.2 support)
Handle.exe C:\Users\username\AppData\Local\Temp
Indicate that it is WinSCP.exe itself that is keeping the files here locked. (no other applications, Antivirus etc)
WinSCP.exe pid: 1234 type: File 3A0: C:\Users\username\AppData\Local\Temp\wscp0123.01234567.tmp
WinSCP.exe pid: 2345 type: File 3D0: C:\Users\username\AppData\Local\Temp\wscp089A.BCDEF012.tmp
0000000011D1D7F0 00000003800551a0 System.String The process cannot access the file '{0}' because it is being used by another process.
0000000011D1D940 0000000080128da0 System.String C:\Users\username\AppData\Local\Temp\wscp0123.01234567.tmp
Relevant frames in call stack with issue:
19 KERNELBASE!RaiseException
1a clr!RaiseTheExceptionInternalOnly
1b clr!IL_Throw
1c mscorlib_ni!System.IO.__Error.WinIOError(Int32, System.String)
1d mscorlib_ni!System.IO.FileStream.Init(System.String, System.IO.FileMode, System.IO.FileAccess, Int32, Boolean, System.IO.FileShare, Int32, System.IO.FileOptions, SECURITY_ATTRIBUTES, System.String, Boolean, Boolean, Boolean)
1e mscorlib_ni!System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, Int32, System.IO.FileOptions, System.String, Boolean)
1f mscorlib_ni!System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare)
20 WinSCPnet!WinSCP.SessionLogReader.OpenLog()
21 WinSCPnet!WinSCP.SessionLogReader.DoRead()
22 WinSCPnet!WinSCP.SessionLogReader.Read(WinSCP.LogReadFlags)
23 WinSCPnet!WinSCP.SessionElementLogReader.Read(WinSCP.LogReadFlags)
24 WinSCPnet!WinSCP.CustomLogReader.WaitForNonEmptyElementAndCreateLogReader(System.String, WinSCP.LogReadFlags)
25 WinSCPnet!WinSCP.Session.Open(WinSCP.SessionOptions)
Issue:
Exceptions occur randomly which seems to be related to how WinSCP handle .tmp file handles internally.
Is this a known issue? Can you handle this in another way? (with .NET 4.5.2 support)
Handle.exe C:\Users\username\AppData\Local\Temp
Indicate that it is WinSCP.exe itself that is keeping the files here locked. (no other applications, Antivirus etc)
WinSCP.exe pid: 1234 type: File 3A0: C:\Users\username\AppData\Local\Temp\wscp0123.01234567.tmp
WinSCP.exe pid: 2345 type: File 3D0: C:\Users\username\AppData\Local\Temp\wscp089A.BCDEF012.tmp
0000000011D1D7F0 00000003800551a0 System.String The process cannot access the file '{0}' because it is being used by another process.
0000000011D1D940 0000000080128da0 System.String C:\Users\username\AppData\Local\Temp\wscp0123.01234567.tmp
Relevant frames in call stack with issue:
19 KERNELBASE!RaiseException
1a clr!RaiseTheExceptionInternalOnly
1b clr!IL_Throw
1c mscorlib_ni!System.IO.__Error.WinIOError(Int32, System.String)
1d mscorlib_ni!System.IO.FileStream.Init(System.String, System.IO.FileMode, System.IO.FileAccess, Int32, Boolean, System.IO.FileShare, Int32, System.IO.FileOptions, SECURITY_ATTRIBUTES, System.String, Boolean, Boolean, Boolean)
1e mscorlib_ni!System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, Int32, System.IO.FileOptions, System.String, Boolean)
1f mscorlib_ni!System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare)
20 WinSCPnet!WinSCP.SessionLogReader.OpenLog()
21 WinSCPnet!WinSCP.SessionLogReader.DoRead()
22 WinSCPnet!WinSCP.SessionLogReader.Read(WinSCP.LogReadFlags)
23 WinSCPnet!WinSCP.SessionElementLogReader.Read(WinSCP.LogReadFlags)
24 WinSCPnet!WinSCP.CustomLogReader.WaitForNonEmptyElementAndCreateLogReader(System.String, WinSCP.LogReadFlags)
25 WinSCPnet!WinSCP.Session.Open(WinSCP.SessionOptions)