.NET Assembly starts slowly (~30 sec)

Advertisement

biop
Joined:
Posts:
5

.NET Assembly starts slowly (~30 sec)

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
WinSCP::SessionOptions ^ sftpSessionOptions = nullptr;
WinSCP::SessionOptions ^ sftpSession = nullptr;
Console::WriteLine("Done");
the word "Done" appears at least 30 seconds after start up of program.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: .NET Assembly starts slowly (~30 sec)

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?

Reply with quote

biop
Joined:
Posts:
5

Thanks for your reply.

:oops: 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/download. 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?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

biop wrote:

I get the source code in https://winscp.net/download/winscp552source.zip/download. 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.

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

Reply with quote

Advertisement

biop
Joined:
Posts:
5

:shock: :shock:
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!! :roll:

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.

Reply with quote

biop
Joined:
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.

Reply with quote

Advertisement

You can post new topics in this forum