XmlSerializer throws FileNotFoundException when debugging

Situation

You are using a XmlSerializer.

Problem

The constructor XmlSerializer(Type) throws a FileNotFoundException when debugging.

Solution

Pre-Compile the Serializer.

See http://msdn.microsoft.com/en-us/library/ee704594.aspx for details.

Alternative

Configure Visual Studio not to break on System.IO.FileNotFoundException thrown by the CLR through

  1. opening the dialog [Debug] – [Exceptions] and
  2. unchecking the checkbox for “Common Language Runtime Exceptions” – “System.IO” – “System.IO.FileNotFoundException”

Sources

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.