TypeLoadException when using SftpClient (Windows Phone)

Dec 8, 2011 at 7:27 PM

I seem to be getting a TypeLoadException whenever i declare a variable of that type. This is what the Exception message says:

{"Could not load type 'Renci.SshNet.SftpClient' from assembly 'Renci.SshNet.WindowsPhone, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."} System.Exception {System.TypeLoadException}

I have only had this problem with the SftpClient. Is anyone else having this problem? Any fix?

Coordinator
Dec 8, 2011 at 7:30 PM

I am new to WindowsPhone development so dont know much, so the only thing I did so far is to test it using emulator for SshClient.

I know that there is problem with reflection in WindowsPhone.

 

I will take a look at it and see what I can find.

 

Thanks,

Oleg

Coordinator
Dec 8, 2011 at 8:19 PM

Ok,

 

I found out what the problem, but dont know the solution just yet.

It seems that WindowsPhone CLR doesnt like this :

private LoadFunc<SftpMessage> _bbb;

when it is defined like this in the same class:

private delegate T LoadFunc<out T>(byte[] data);

I'll see what I can find or may be some kind of workaround for WindowsPhone version.

 

Thanks,

Oleg

Dec 8, 2011 at 8:26 PM

Wow, thanks for the quick response!

Sounds great.

Coordinator
Dec 9, 2011 at 4:55 PM

Hi,

 

Can you take a look at this 12787 changeset.

 

I made some changes and and it seems to be working fine, well at least in emulator.

 

Let me know if have problems or questions,

Thanks,

Oleg

Dec 9, 2011 at 5:10 PM

Seems to be working.

Thanks for the excellent support!