Encoding error when creating Ftp instance

0 votes

so im trying to create an ftp object to download all files off of a server but at runtime an exception is thrown tith the following description:

System.TypeInitializationException: 'The type initializer for
'Limilabs.FTP.Client.TcpTextClient' threw an exception.'

ArgumentException: 'windows-1252' is not a supported encoding name.
For information on defining a custom encoding, see the documentation
for the Encoding.RegisterProvider method.

im creating the object and using it like this:

 using (Ftp ftp = new Ftp()) {
      ftp.Connect(url);    // or ConnectSSL

      if (Directory.Exists(RootDirectory + "\\Temp")) {
           Directory.CreateDirectory(RootDirectory + "\\Temp");
      }

      RemoteSearchOptions options = new RemoteSearchOptions("*", true);
      ftp.DownloadFiles(@"\fdata\pos\invoices", RootDirectory + "\\Temp", options);

      ftp.Close();
 }
asked Nov 17, 2017 by Joshua Smith
What framework version are you targeting?
I am targeting .Net 2.0 as i am making a console application.
Are you sure?

.Net 2.0 was released over 10 years ago and is now obsolete.

Net20 folder in the download package contains assembly that can be used in .Net 2.0.
in my properties for the solution it defaulted to .Net 2.0 for the Console application, and it asks me to install more otherwise. I have the latest .Net installed and have confirmed it works as I have created a windows form application with it. I am downloading the 4.7.1 devpack just to make sure however.

1 Answer

0 votes

Ftp.dll requires full .Net framework. We'll provide .NET standard package soon.
You may try installing System.Text.Encoding.CodePages package and using registering encodings with the following line:

System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
answered Nov 17, 2017 by Limilabs support (230,760 points)
when you say full .Net framework, do you mean .Net 4 or are there packages that are used, that are not in the .Net core?
Full .Net framework is not .Net core. Current .Net framework version is 4.7.1. Ftp.dll supports versions 2.0 - latest.
...