C# System.TypeInitializationException was unhandled exception [Solved]

Standard



When  i found error, I search for this exception.
Generally, a TypeInitializionException is thrown when another exception happens inside a static constructor.
Check for the InnerException property of the former, and you will get more information about the actual error.


Ref. http://stackoverflow.com/questions/7202543/how-to-solve-system-typeinitializationexception-was-unhandled-exception-in-vb-ne
------------------------------------------------------------------------------------------
my exception is.
{"The type initializer for 'Myproject.Main' threw an exception."}
and InnerException  is
{"Could not load file or assembly 'MySql.Data, Version=6.4.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"MySql.Data, Version=6.4.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"}
It's error from MySql.Data . I fixed by remove and add reference again.