.net - 为什么.NET 试图加载一个不存在的程序集?

标签 .net vb.net c#-4.0

<分区>

尝试在引用的程序集中执行函数时出现这个奇怪的错误。我有程序集的源代码,但没有名为“XmlSerializers”的命名空间,所以我无法理解为什么它会尝试加载“Netaccounts.Ola.RestClient.XmlSerializers”

谁能建议从哪里开始解决这个问题?我认为 .Net 框架或 visual studio 有问题,因为这对我来说毫无意义。

它发生在这条线上

XmlSerializer serializer = new XmlSerializer(type);

但 XmlSerializer 来自 System.Xml.Serialization。我什至重写了代码,但没有效果。我得到了同样的错误。

System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(type);

干杯!

BindingFailure occurred
Message: Managed Debugging Assistant 'BindingFailure' has detected a problem in 'D:\Local Dev Projects\Projects\WRJ Studio\WRE Quote Builder\bin\Debug\WRJ Studio.vshost.exe'.
Additional information: The assembly with display name 'Netaccounts.Ola.RestClient.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'Netaccounts.Ola.RestClient.XmlSerializers, Version=1.0.5101.5654, Culture=neutral, PublicKeyToken=1809573d4ad081b2' or one of its dependencies. The system cannot find the file specified.

最佳答案

这是一个完全正常的警告,如 this answer 中所述。 .这也不异常(exception)。

您几乎肯定在“调试 + 异常”对话框中犯了错误。您不小心单击了 Managed Debugging Assistants 的 Throw 复选框,实际上将它们全部打开。打开节点并取消选中“BindingFailure”警告。如果您看到它们都已勾选,则单击“全部重置”按钮将所有内容恢复到应有的状态。

关于.net - 为什么.NET 试图加载一个不存在的程序集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20665590/

相关文章:

.net - 使用 vb.net 从 Sql 数据库插入、更新和删除数据?

javascript - 通过javascript更改iframe src时,整个页面刷新

c# - DataGrid 自动生成的列 : Increasing width

c# - 空传播运算符

.net - 如何在没有控件的情况下获得自动完成功能

IE7,8 的 ASP.NET TreeView 性能问题

.net - Linq to SQL 创建表

c# - 将小数四舍五入到第一个不为零的小数位

asp.net/VB.net : FindControl, 而不是通过 ControlType 通过 ID

c# - 为什么 C# 不推断我的泛型类型?