是什么原因导致System.TypeLoadException? [英] What could be causing a System.TypeLoadException?
问题描述
我正在使用VS2008和C#开发霍尼韦尔海豚6100的应用程序,霍尼韦尔海豚6100是带有条形码扫描仪的移动计算机,该条形码扫描仪使用Windows CE 5.0(如OS).
I'm developing, with VS2008 using C#, an application for Honeywell Dolphin 6100, a mobile computer with a barcode scanner that uses Windows CE 5.0 like OS.
我想添加一个功能,该功能可以将文件从本地设备发送到远程服务器.我找到了库" Tamir.SharpSSH ".可以保证这一点.我在控制台应用程序和普通Windows窗体应用程序上测试了代码,它可以完美地工作.但是,当我尝试在winCE设备上使用相同的代码时,出现TypeLoadException并收到错误消息:
I want to add a functionality that can send files from the local device to the distant server. I found the library "Tamir.SharpSSH" which can guarantee this. I tested the code on a console application and on normal windows forms application and it works perfectly. But when I tried to use the same code on the winCE device, I get a TypeLoadException and I have the error message:
Could not load type 'Tamir.SharpSsh.SshTransferProtocolBase' from assembly 'Tamir.SharpSSH,
Version=1.1.1.13, Culture=neutral, PublicKeyToken=null'.
我使用的代码如下:
SshTransferProtocolBase sshCp = new Scp(Tools.GlobalVarMeth.hostName, Tools.GlobalVarMeth.serverUserName);
sshCp.Password = Tools.GlobalVarMeth.serverUserpassword;
sshCp.Connect();
string localFile = Tools.GlobalVarMeth.applicationPath + "/" + fileName + ".csv";
string remoteFile = Tools.GlobalVarMeth.serverRemoteFilePath + "/" + fileName + ".csv";
sshCp.Put(localFile, remoteFile);
sshCp.Close();
有人对此有任何想法吗?我将非常感谢!!!
Any one have any idea on this ? I will be really grateful !!!
推荐答案
可能有很多东西.可能的原因是:
It could be any number of things. Likely causes are:
- 找不到程序集
- 找不到您的程序集所依赖的程序集
- 找到了程序集,但类型不在其中
- 类型的静态构造函数引发异常
您最好的选择是使用Fusion日志查看器来帮助对其进行诊断.文档在这里:
Your best bet is to use the Fusion log viewer to help diagnose it. Documentation is here:
http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx
(FYI"Fusion"是设计装配件装载系统的团队的代号;不幸的是,代号以出厂产品的文件名结尾.该名称应称为"AssemblyBindingLogViewer. exe"或类似的东西.)
(FYI "Fusion" was the code name of the team that designed the assembly loading system; it is somewhat unfortunate that the code name ended up in the file name of the shipped product. The thing should have been called "AssemblyBindingLogViewer.exe" or some such thing.)
这篇关于是什么原因导致System.TypeLoadException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!