This project is read-only.

TypeLoadException when using SftpClient (Windows Phone)

Dec 8, 2011 at 8: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=, 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?

Dec 8, 2011 at 8: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.




Dec 8, 2011 at 9:19 PM



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.




Dec 8, 2011 at 9:26 PM

Wow, thanks for the quick response!

Sounds great.

Dec 9, 2011 at 5:55 PM



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,



Dec 9, 2011 at 6:10 PM

Seems to be working.

Thanks for the excellent support!