为什么XmlSerializer不会在Visual Studio 2019中引起FileNotFoundException? [英] Why does XmlSerializer NOT cause FileNotFoundException in Visual Studio 2019?

查看:37
本文介绍了为什么XmlSerializer不会在Visual Studio 2019中引起FileNotFoundException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我最初遇到此问题中描述的问题: XmlSerializer在构造函数中提供FileNotFoundException

So I originally encountered the issue described in this question: XmlSerializer giving FileNotFoundException at constructor

但是,我们刚刚从Visual Studio(VS)2013 Pro升级到VS 2019 Pro.现在,当我打开了所有的公共语言运行时(CLR)异常(引发时中断),包括System.IO.FileNotFoundException时,我没有中断该异常.我认为这与目标.NET Framework(我们也已升级到.NET 4.8)有关.

However, we just upgraded from Visual Studio (VS) 2013 Pro to VS 2019 Pro. Now, when I have all Common Language Runtime (CLR) Exceptions turned on (break when thrown) including System.IO.FileNotFoundException, I do not get a break on the exception. I thought it was something to do with the targeted .NET Framework (we also upgraded to .NET 4.8).

也就是说,我做了一个测试:

That said, I did a test:

  1. 在VS 2019中针对我们的起始框架版本.NET 4.5.2创建了一个测试WinForms项目.
  2. 添加以下默认的Form1类:

public static readonly XmlSerializer kXMLSerializerList = new XmlSerializer(typeof(List<string>));

  1. 确保所有CLR异常(包括System.IO.FileNotFoundException)都已打开.
  2. 构建.
  3. 在VS 2019中启动调试器.

结果:在异常情况下不会中断

Result: No break on an exception

好的,让我们尝试VS 2013

OK, let's try VS 2013

  1. 启动VS 2013
  2. 打开相同的项目.
  3. 重建.
  4. 在VS 2013中启动调试器.

结果:XmlSerializer FileNotFoundException

Result: XmlSerializer FileNotFoundException

因此,这似乎不是.NET Framework版本依赖性.IDE依赖项?这让我感到困惑.还是C#版本依赖性?有任何线索吗?

So it doesn't seem to be a .NET Framework version dependency. An IDE dependency? That confuses me. Or is it a C# version dependency? Anyone have any clues?

推荐答案

B.就是选中了我的代码".

Bah. It was that "Just My Code" was checked.

我以为我没有检查,但是我错了...对不起所有人...

I was thinking I had that unchecked, but I was wrong...sorry to all...

垂头丧气:(

这篇关于为什么XmlSerializer不会在Visual Studio 2019中引起FileNotFoundException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆