The problem I have is that when running my program outside of Visual Studio, this error message gets thrown and pops up as an error shown to my users. This is only happening on one computer (Windows Server 2016). According to this question this exception is supposed to be thrown and handled internally by XmlSerializer. This is not being run in Visual Studio, so the option to debug just my code doesn't apply. Unfortunately, Google is only turning up answers where this exception was intercepted during debugging with Visual Studio, which doesn't help me. I realize that there is a "generate serialization assembly" option in each VS project that I could change from auto. My problem with that solution is that I don't want to have a custom build just for this client, especially when no one else suffers this problem.
2021-08-27 Update with more information
What is the problem?
Why is the error "Could not load file or assembly 'MyAssembly.XmlSerializers'" being thrown by the .NET Framework (v4.7.2 specifically) and propagating out to my code in production, when this should be handled internally by the .NET Framework?
What debugging have I done?
- Tested the software in a clean Windows Server 2016 virtual machine - no issue there
- Generated the
XMlSerializers.dll
files usingsgen.exe
, this removes the error message, but doesn't explain why the .NET Framework did not handle these missing files as it should. Its a Band-Aid without understanding the underlying problem. - Lots of Googling to find any source of this error, but the search results only apply if the code is being debugged inside Visual Studio, which it isn't in this case.