Re: Potential cause for "The version of ...WinSCP.exe () does not match version of this assembly" error.
@starnet: We need debug log files, as mentioned above.
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
My services are also intermittently encountering this error.
The version of ..\WinSCP.exe () does not match version of this assembly ..\WinSCPnet.DLL (5.11.1.0). at
WinSCP.ExeSessionProcess.CheckVersion(String exePath, FileVersionInfo assemblyVersion) at
WinSCP.ExeSessionProcess..ctor(Session session, Boolean use_XmlLog, String additionalArguments) at
WinSCP.Session.Open(SessionOptions sessionOptions) at
FileVersionInfo.GetVersionInfo
to retrieve the version information of the exe.
FileVersionInfo.GetVersionInfo
, and it checks for the existence of the file and validates permissions, both of which didn't trigger any error. It eventually calls the Windows API method GetFileInfoVersionSize
, which can return 0 if an error occurs. However, GetVersionInfo
itself does not check for any errors if GetFileInfoVersionSize
returns 0 (as recommended by the documentation of GetFileInfoVersionSize
), and so we can see a plausible scenario where FileVersionInfo.GetVersionInfo
can quietly return a version info object with null properties.
GetFileInfoVersionSize
to return 0 in the first place. We should be able to replicate the error if we can find a way to reliably force GetFileInfoVersionSize
to return 0 for a valid exe.
FileVersion.GetVersionInfo
for version checking would be to use Process.MainModule.FileVersionInfo.ProductVersion
, i.e., we do version checking only after calling _process.Start()
.
Session.DebugLogPath
. Submit the log with your post as an attachment. You may want to remove data you consider sensitive, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.winscp.exe () does not match version of this assembly WinSCPnet.DLL (5.9.1.0)
Exe Version
Major Minor Build Revision
----- ----- ----- --------
5 9 1 6885
Major Minor Build Revision
----- ----- ----- --------
1 3 4 6885