My Windows Forms application was working earlier, however suddenly it stopped working. I am getting following exception:
I got the same error message and for my case the reason is my main program is set to build as 32 bit console app and I added a private variable logger which access a 64bit dll.
public class Program
{
public static readonly Logger logger = new Logger(typeof(Program));
After I changed the main program to be build as 64bit, the issue is fixed.
I've the same problem: runs program in MS VS 2015 and triggers an exception message:
System.TypeInitializationException was unhandled
Message: An unhandled exception of type 'System.TypeInitializationException' occurred in mscorlib.dll
Additional information: Der Typeninitialisierer für "<Module>" hat eine Ausnahme verursacht.
The question where source this exception? So, I started the EXE file and displayed the exception message dialog. Answer on "debug mode" with MS VS so become more information displayed about exception.
System.IO.FileNotFoundException was unhandled
Message: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
Additional information: Die Datei oder Assembly "SIC, Version=19.2.6.3, Culture=neutral, PublicKeyToken=**************" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
I go to this reference and analyse properties Property: "Copy Local" is on false - because before was a installed into GAC Solution: property "Copy Local" set on true and builds new assembly and works :-)
Maybe this information helpful! So have a good day.
I've got the same error with platform target set as any CPU and prefer 32-bit checked, unchecking that last one solved my problem.
In my case it was a very silly thing. I had accidentally typed something like this
<configuration>
<appSettings>
<add key="someKey" value="SomeValue" />sss
<add key="someKey1" value="SomeValue1" />
</appSettings>
</configuration>
sss - Caused the error for me. Any random character entry.
This issue for me was caused by a rogue user.config file that was created in the AppData\Local[Manufacturer][Product Name] directory. I'm not sure how it got there, but seems to be created every now and then.
A possible reason: init a static dictionary with duplicated keys.