How can we help you today? How can we help you today?

System.IO.FileNotFoundException' occurred in mscorlib.dll

So my code worked fine, then after using .NET Reflector it is now broken. Basically when trying to execute
XmlSerializer serializer = new XmlSerializer(typeof(List<Device>));
I get a System.IO.FileNotFoundException' occurred in mscorlib.dll error.

The full error message is: Could not load file or assembly 'mscorlib.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

any ideas?

further, I have tried re-adding the system.xml references, I have tried
] System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(List<Device>));
, tried rebooting but nothing
theonion
0

Comments

3 comments

  • theonion
    OK after spending the best part of three hours trying to fix this and then finally posting here, within five minutes I had fixed the issue. Always the way. The solution was simple in the end:

    In Visual Studio 2008 go to: Tools -> Import/Export settings -> Reset All Settings
    theonion
    0
  • Clive Tong
    Hi.

    I don't think that's anything to do with Refector. If you take a simple console application with the code:

    class Program
    {
    static void Main(string[] args)
    {
    XmlSerializer serializer = new XmlSerializer(typeof(List<Program>));
    }
    }

    If you check Debug/Exceptions "CLR Exceptions" Thrown you get the FileNotFoundException that you mention ie it is supposed to happen and usually the code handles it and moves on. However, if the debugger is set to break when the exception is thrown, then it stops at that point. There is a "Reset All" button on the Debug/Exceptions dialog that will reset the break state to the default which would continue over this exception.
    Clive Tong
    0
  • Clive Tong
    There is another setting that is changed when you use Reflector Pro that is relevant here. The "Enable Just My Code" on the Tools/Options Debugging/General dialog. The setting of this would have affected whether the exception thrown inside mscorlib stops in the debugger.
    Clive Tong
    0

Add comment

Please sign in to leave a comment.