Version mismatch error WinSCPnet.DLL (5.9.1.0)

Advertisement

Guest

Version mismatch error WinSCPnet.DLL (5.9.1.0)

Hello,

We have been using WinSCP version 5.9.1.0 since past 1 year and it has worked fine all this while. Suddenly, it has started to report intermittent errors as below
winscp.exe () does not match version of this assembly WinSCPnet.DLL (5.9.1.0)
We haven't changed anything in the code. We also have another application using WinSCP.exe and it is also referencing the same version. Both these applications have been working fine up until last 2–3 weeks.

As mentioned, it is intermittent and does not occur frequently. some of the info as suggested in the guidelines are here:

Version of WinSCP
Exe Version
Major  Minor  Build  Revision
-----  -----  -----  --------
5      9      1      6885
Dll version
Major  Minor  Build  Revision
-----  -----  -----  --------
1      3      4      6885
No upgrades performed what so any.

Windows Server 2008

SFTP

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
42,186
Location:
Prague, Czechia

Re: version mismatch error WinSCPnet.DLL (5.9.1.0)

Please attach a full debug log file showing the problem (using the latest version of WinSCP).

To generate the debug log file, set 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.

Reply with quote

donnr
Joined:
Posts:
1

Potential cause for "The version of ...WinSCP.exe () does not match version of this assembly" error.

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
Checking the source code for WinSCPnet, I find that it is using FileVersionInfo.GetVersionInfo to retrieve the version information of the exe.

I checked the source of 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.

If the above is the case, I'm not sure what the best approach would be to mitigate this issue, or how to find out what caused 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.

UPDATE – A potential fix?:
An alternative to using FileVersion.GetVersionInfo for version checking would be to use Process.MainModule.FileVersionInfo.ProductVersion, i.e., we do version checking only after calling _process.Start().

Reply with quote

martin
Site Admin
martin avatar

Re: Potential cause for "The version of ...WinSCP.exe () does not match version of this assembly" error.

donnr wrote:

My services are also intermittently encountering this error.
Can you post a debug log file for both successful and failed run?

Reply with quote

Guest

Re: Potential cause for "The version of ...WinSCP.exe () does not match version of this assembly" error.

We enabled debug logging at one point but it kept on being overwritten every time a new session is opened. As of now, debug logging is disabled in production and the soonest we can have it reenabled is on the February service release.

Reply with quote

Advertisement

starnet
Guest

Re: Potential cause for "The version of ...WinSCP.exe () does not match version of this assembly" error.

I'm having this issue as well. It appears I get this error randomly. I installed your package via NuGet and I am sure .dll and .exe are same version.

Reply with quote

martin
Site Admin
martin avatar

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.

Reply with quote

Advertisement

You can post new topics in this forum