Why does XmlSerializer NOT cause FileNotFoundException in Visual Studio 2019? [closed]

爱⌒轻易说出口 提交于 2020-01-24 09:06:08

问题


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

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. Created a test WinForms project in VS 2019 targeting .NET 4.5.2, our starting framework version.
  2. Add the following the default Form1 class:
public static readonly XmlSerializer kXMLSerializerList = new XmlSerializer(typeof(List<string>));
  1. Ensure all CLR Exceptions including System.IO.FileNotFoundException were on.
  2. Build.
  3. Launch the debugger in VS 2019.

Result: No break on an exception

OK, let's try VS 2013

  1. Start VS 2013
  2. Open the same project.
  3. Rebuild.
  4. Launch the debugger in VS 2013.

Result: XmlSerializer FileNotFoundException

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?


回答1:


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

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

Hangs head in shame :(



来源:https://stackoverflow.com/questions/59736149/why-does-xmlserializer-not-cause-filenotfoundexception-in-visual-studio-2019

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!