奇怪的异常创建新的XmlSerializer

时间:2019-04-22 21:54:08

标签: c# xmlserializer fileloadexception

我正在为自定义类实例化XmlSerializer。代码行非常简单:

mySerializer = new XmlSerializer(typeof(myClass));

我最近在Visual Studio 2017的“异常设置”窗口中为所有“ C ++异常”将选项设置为“抛出时中断”,现在在执行此行时会获得多个异常。我还可以在“输出”窗口中看到此行抛出6个连续的异常:

Exception thrown at 0x7565C5AF in myWinFormsApp.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x003BC7BC.
Exception thrown at 0x7565C5AF in myWinFormsApp.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x7565C5AF in myWinFormsApp.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x7565C5AF in myWinFormsApp.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x003BC6DC.
Exception thrown at 0x7565C5AF in myWinFormsApp.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x7565C5AF in myWinFormsApp.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.

奇怪的是,这些异常没有被try ... catch块捕获,不中断程序执行流程,并且随后的代码正确地序列化和反序列化了myClass。

我能想到的唯一不寻常的事情是我在.NET Framework 4.6.1项目中实例化了XmlSerializer,并且在.NET Standard 2.0项目中定义了“ myClass”。

可能是什么原因造成的?将代码移至24/7生产环境时,我应该担心吗?谢谢!

0 个答案:

没有答案