C#: not returning after call session.open

Advertisement

forester
Joined:
Posts:
3

C#: not returning after call session.open

Hi,

I try to use the automation.
Dev envrionment Win 7 64bit, net 4.0, SharpDevelp.

Source code taken from https://winscp.net/eng/docs/library C# Example.

Working with version 5.5.4. Copied content of install dir to my debug-dir, added winscpnet.dll. Did the registration with "%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe WinSCPnet.dll /codebase /tlb". Added the reference via com-Browser and selected winscpnet.dll.

Compiler works fine. No messages.

When running, it goes up to line
"session.Open(sessionOptions);"
calls this and disappears for ever. Will say, nothing happens any more. No log at the ftp-Server side, no message at all. In the Windows TaskManager I see one instance of winscp.exe.

I repeated with older version 5.5.0, i tried by using the NuGet packages. Always the same.
When I use a non matching winscp.exe the .open statement tells me "non matching versions".

By the way, same thing for Visual Basic.

I am desperate. :cry:

What is my mistake?

Thanks for any help.
Forester

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Re: C#: not returning after call session.open

Please set Session.DebugLogPath and attach the log here. Thanks.

forester wrote:

Working with version 5.5.4. Copied content of install dir to my debug-dir, added winscpnet.dll. Did the registration with "%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe WinSCPnet.dll /codebase /tlb". Added the reference via com-Browser and selected winscpnet.dll.
No need for this. In C#, you are using the WinSCPnet.dll as a .NET assembly not via COM interop.

Reply with quote

forester
Joined:
Posts:
3

Dear prikryl,

thanks for the hint with the debug-log. I activated it.

I found out the test program started as exe outside sharpdevelop works fine (see attached log).
Only by running in debug mode step by step from within sharpdevelop it hangs. Comparing both debug output files I see one early error:
Error getting counters: System.InvalidOperationException: Die Kategorie ist nicht vorhanden.

Please have a look yourself.
Thank you for your help.

Forester
Description: WinSCP-Debug output when running in SharpDevelop step by step debug mode
Description: WinSCP-Debug output when starting the exe outside SharpDevelop

Reply with quote

martin
Site Admin
martin avatar

The "Error getting counters" is not relevant on its own, though it may have common cause.

It looks like the code is somehow aborted or stalls. I cannot explain that. Did you try to build the assembly from source code and debug it?

Reply with quote

forester
Joined:
Posts:
3

C#: not returning after call session.open

Dear Pricryl,

thanks for you reply.

I tried some more time without successes.
Now I changed from SharpDevelop to MS Visual Studio Express and it works fine.

Forester

Reply with quote

Advertisement

You can post new topics in this forum