当前位置:  开发笔记 > Android > 正文

为什么我的XmlSerializer出错了?

如何解决《为什么我的XmlSerializer出错了?》经验,为你挑选了2个好方法。

我对我的工作应用程序进行了一些更改,并开始在这行代码中收到以下错误.

Dim Deserializer As New Serialization.XmlSerializer(GetType(Groups))

这是错误.

    BindingFailure was detected
    Message: The assembly with display name 'FUSE.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 'FUSE.XmlSerializers, Version=8.11.16.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'FUSE.XmlSerializers, Version=8.11.16.1, Culture=neutral, PublicKeyToken=null'

    Message: The assembly with display name 'FUSE.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 'FUSE.XmlSerializers, Version=8.11.16.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'FUSE.XmlSerializers, Version=8.11.16.1, Culture=neutral, PublicKeyToken=null'

=== Pre-bind state information ===
LOG: User = DOUG-VM\Doug
LOG: DisplayName = FUSE.XmlSerializers, Version=8.11.16.1, Culture=neutral, PublicKeyToken=null, processorArchitecture=MSIL
 (Fully-specified)
LOG: Appbase = file:///E:/Laptop/Core Data/Data/Programming/Windows/DotNet/Work Projects/NOP/Official Apps/FUSE WPF/Fuse/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\Laptop\Core Data\Data\Programming\Windows\DotNet\Work Projects\NOP\Official Apps\FUSE WPF\Fuse\bin\Debug\FUSE.vshost.exe.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///E:/Laptop/Core Data/Data/Programming/Windows/DotNet/Work Projects/NOP/Official Apps/FUSE WPF/Fuse/bin/Debug/FUSE.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///E:/Laptop/Core Data/Data/Programming/Windows/DotNet/Work Projects/NOP/Official Apps/FUSE WPF/Fuse/bin/Debug/FUSE.XmlSerializers/FUSE.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///E:/Laptop/Core Data/Data/Programming/Windows/DotNet/Work Projects/NOP/Official Apps/FUSE WPF/Fuse/bin/Debug/FUSE.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///E:/Laptop/Core Data/Data/Programming/Windows/DotNet/Work Projects/NOP/Official Apps/FUSE WPF/Fuse/bin/Debug/FUSE.XmlSerializers/FUSE.XmlSerializers.EXE.

这是怎么回事?



1> Doug..:

发生这种情况的主要原因是因为我尝试序列化和反序列化的类型不匹配.我是序列化ObservableCollection(组)和反序列化业务对象 - 继承了ObservableCollection(Group)的组.

这也是问题的一部分......来自 - http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/9f0c169f-c45e-4898-b2c4-f72c816d4b55/

此异常是XmlSerializer正常操作的一部分.它是预期的,将在Framework代码中捕获和处理.只需忽略它并继续.如果在调试期间困扰您,请将Visual Studio调试器设置为仅停止未处理的异常而不是所有异常.


解决此问题的一种可能方法是在工具 - >选项 - >调试 - >常规选项中选中"仅我的代码"选项.
另一个(VS2010):Debug - > Exceptions; 托管调试协助 - > BindingFailure - >取消选中"Thrown".
非常感谢,我正在玩我的Debug/Exceptions并忘了.非常感谢.
@Irwin因为这个原因而失去了2小时的生命> <

2> Lukasz M..:

根据我发现的信息,与XmlSerializers关联的BindingFailure异常有时并不表示任何错误,应该被忽略,但是有时可以看到它,即在调试模式下,当你设置VS选项以显示所有抛出的异常时.

资料来源:https: //connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedidID = 88566&wa = newsignin1.0

顺便说一句.这或多或少是第一个答案中提到的事情之一:).


IMO,添加额外的答案不是问题.
我已经更准确地写了答案,因为人们一直在问这个问题.我写了它,所以解决方案会更加明显,尽管在某些情况下解决方案可能会有所不同.
推荐阅读
依然-狠幸福
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有