BeginGetList and EndGetList Methods not found in 2014 R2 release

0 votes
asked Jul 21, 2014 by Ftp (300 points)
edited Jul 22, 2014

Hello,

We have implemented like the below way to get the directories and files list from FTP client object.

                IAsyncResult ar = client.BeginGetList(null, null);
                while (!ar.IsCompleted)
                {
                    if (isFromObjects == false)
                    {
                        Application.DoEvents();
                    }
                    System.Threading.Thread.Sleep(1);
                }
                FtpList fileFolderList = client.EndGetList(ar);

Now we have upgraded to latest 2014 R2 version. In the latest version we are getting build errors that the BeginGetList and EndGetList methods are not found in latest 2014 R2 FTP client object.

Earlier we have copied the above code from sample application which Rebex has provided.

Please help me resolve the above issue.

Regards, Shahin.

Applies to: Rebex FTP/SSL

1 Answer

0 votes
answered Jul 21, 2014 by Tomas Knopp (58,890 points)
edited Jul 22, 2014

Hello,

since release 2012R3 the old async API BeginXYZ/GetXYZ methods are not accessible under .NET 4.0 / .NET 4.5. However, you can still get access to them, just add

using Rebex.Legacy;

namespace into your program and your old code will work as before.

See more info about upgrading from 2012R2 or older.

commented Jul 21, 2014 by Ftp (300 points)
edited Jul 21, 2014

Hello Tomas,

Actually this code I have copied from earlier version of Rebex. Can I remove these lines of code and write like below ?

FtpList list = _ftp.GetList();

Regards, Shahin

commented Jul 21, 2014 by Tomas Knopp (58,890 points)
edited Jul 21, 2014

If you do not need the operation to be executed in background then the normal Ftp.GetList method is suitable for you.

commented Jul 21, 2014 by Ftp (300 points)
edited Jul 21, 2014

If we want to execute in background, what is the code I need to write in latest 2014 R2 version?

commented Jul 22, 2014 by Tomas Knopp (58,890 points)
edited Jul 22, 2014

Well, if you have a working solution I guess it is really the best to add the

using Rebex.Legacy;

namespace and keep using the old style async code. Are you able to compile and run after importing the Rebex.Legacy namespace? If not please let us know.

...