TypeConverter error when using 'Recieve Multiple Files'

May 14, 2013 at 8:52 AM

I am trying to use the 'Recieve Multiple Files' action and I get I get the following error on the SFTP task when executing the package. I have simplified my package to a script task which creates an empty ISFTPFileInfo list variable and the SFTP task and still I get the error.

[Execute: ] Error: TypeConverter cannot convert from System.String.
at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
at System.ComponentModel.TypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at SSIS.Extensions.Common.GetVariableValue[T](String varName, VariableDispenser variableDispenser)
at SSIS.Extensions.SFTPTask.SFTPTask.Execute(Connections connections, VariableDispenser variableDispenser, IDTSComponentEvents componentEvents, IDTSLogging log, Object transaction)

Does anyone have any ideas?
SQL 2012 VS2010
May 20, 2013 at 2:12 PM
Have you tried the sample project? There is an example of this.
May 20, 2013 at 2:25 PM
The sample project gives the same error. I downloaded the source code but I found this to be out of sync with the compiled version as the multiple file options are not implemented in the code. I have since implemented my own receieve multiple files option in the downloaded source code which seems to be working for now.

Jul 12, 2013 at 11:29 PM
I too have the same problem; how did you resolve it?
Jul 13, 2013 at 12:07 AM
I ended up implementing the recieve multiple file action myself by modifying the source code provided. The recieve multiple files option was not implemented in the source code I download which would explain this error if the compiled version was compiled with the source I downloaded. I raised this as an issue and mcpunjabi commented that his has uploaded the source again. It might be worth a try compiling the source code available now. If that doesn't work then could send you the changes I made.
Regards Daniel
Jul 23, 2013 at 10:49 AM

Did you recieve the file I sent with the source code?

Daniel Forrester

Jan 16, 2014 at 1:02 PM

Can you please share the fix I am having the same failure with send and receive multiple files

Jan 16, 2014 at 1:58 PM
Hi Chris,

I have not tried this before but I have uploaded my source code with the implemented 'Retrieve Multiple' to the patches section under source code. I'm not sure if it needs to be approved before you can download it. Let me know if you can't download it and well try another method.

Jan 17, 2014 at 5:08 AM

Thanks for that I got the code and it put me on the correct path, I am building on the sql2012 solution. It seems in the 2012 code base due to its use of generics there needs to be an implementation of System.ComponentModel.TypeConverter for the generic list of SFTPFileInfo objects.

I could not manage to get that working but using your implementation in common.cs and SFTPTask.cs , I updated the generic method GetVariableValue<T> to return the correct object.

The following statement is causing the failure in the current 2012 build:

value = (T)System.ComponentModel.TypeDescriptor.GetConverter(typeof(T)).ConvertFrom(obj);

I changed that to the following block
            if (obj.Equals("System.Collections.Generic.List`1[SSIS.Extensions.SFTP.ISFTPFileInfo]") && (!typeof(T).Name.Equals("String")))
                object objValue = default(object);
                objValue = (object)vars.OfType<Variable>().Where(x => x.QualifiedName == varName).FirstOrDefault().Value;
                return (T)objValue;
            } else {
                value = (T)System.ComponentModel.TypeDescriptor.GetConverter(typeof(T)).ConvertFrom(obj);
                return value;
Not the most elegant workaround but send and receive multiple files is now working for me, hopefully someone with a bit more knowledge on generics and converters can implement the converter in the future.

Thanks for the info