Topic ".NET Assembly starts slowly (~30 sec)"

Author Message
biop
[View user's profile]

Joined: 2014-03-21
Posts: 5
Dear all,

I am testing out the C# example in https://winscp.net/eng/docs/library#csharp. I find out when it starts up, it takes about 30 seconds or so before initialization of SessionOptions object. Why is there this delay? And how can I reduce the delay?

I am required to write a C++/CLI program using WinSCP. I follow that C# example and have converted it (manually) to C++/CLI version of it. Likewise, when the program reaches the initialization of SessionOptions object, it takes 30 seconds already. Why? Can it be shortern?

For C# program, if I comment out everything in Main() but have only one WriteLine('Done') statement, the program returns immediately.
For C# program, if I have only the initialization of SessionOptions and that WriteLine() statement, the program takes about 32 seconds to return.

For C++/CLI program, if I comment out everything in Main() and even the #using "WinSCPnet.dll" but have that one WriteLine() statement, the program returns immediately.
For C++/CLI program, if I uncomment #using "WinSCPnet.dll", and have
Code:

WinSCP::SessionOptions ^ sftpSessionOptions = nullptr;
WinSCP::SessionOptions ^ sftpSession = nullptr;
Console::WriteLine("Done");

the word "Done" appears at least 30 seconds after start up of program.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
WinSCP .NET assembly does not have any expensive initialization code, so I really do not know what can cause a delay on your system. I haven't seen it before. Did you try to download assembly source code and debug it?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Copy of this question on stackoverflow.com:
http://stackoverflow.com/questions/22603948/how-to-make-winscp-net-assembly-perform-faster
biop
[View user's profile]

Joined: 2014-03-21
Posts: 5
Thanks for your reply.

Embarassed Sorry that I cross post to the StackExchange because I want to get more people to answer on this.

I get the source code in https://winscp.net/download/winscp552source.zip. I will start running debug mode on this.

[Edit]: Hum... I am using Visual Studio... And the source code is in C++ builder? Do not know how to integrate with Visual Studio...

So are you saying when you start that C# example, it returns (almost) immediately?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
biop wrote:
I get the source code in https://winscp.net/download/winscp552source.zip. I will start running debug mode on this.

[Edit]: Hum... I am using Visual Studio... And the source code is in C++ builder? Do not know how to integrate with Visual Studio...

You are interested in dotnet\WinSCPnet.csproj only. That's C# Visual Studio project.

Quote:
So are you saying when you start that C# example, it returns (almost) immediately?

Sure.
biop
[View user's profile]

Joined: 2014-03-21
Posts: 5
Shocked Shocked
If the C# example does not have any delay in running, why I am seeing this? Could this be anything related to server setting? Firewall blocking something? I use the WinSCP.exe to connect to destination server from my local machine. There is no such delay! But I run the C# example, even in the destination server, it takes 30 seconds before the first statement!! Rolling Eyes

By the way, at the same time, I will use a C++ program to use COM method to call in the dot net assembly. I hope I can figure out how to do.
biop
[View user's profile]

Joined: 2014-03-21
Posts: 5
Embarassed Embarassed
Sorry I figure out. Somehow I am using version 5.5.1 of WinSCP.exe but version 5.5.2 of WinSCPnet.dll!!!
biop
[View user's profile]

Joined: 2014-03-21
Posts: 5
I play around with version 5.5.1 and 5.5.2.

C# example with version 5.5.1 EXE and dot net assembly: There is delay in startup.

C# example with version 5.5.2 EXE and dot net assembly: There is no delay in startup!

So if you use dot net assembly, use 5.5.2 instead of 5.5.1.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Thanks for sharing your findings.
Though there's only single line difference between 5.5.2 and 5.5.1 assemblies. And the line should affect COM interface only:
https://winscp.net/tracker/show_bug.cgi?id=1134
So it rather looks like a local problem of yours.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License