C# console app throws System.TypeInitializationException at Program..cctor() at Program.Main(String[] args)


I have a console .NET application, let's call it MyProject, which runs scheduled using Windows Task Scheduler. I've noticed a command window that shows the following output in the black cmd window:

Unhandled Exception: System.TypeInitializationException: The type initializer for 
'MyProject.Program' threw an exception. ---> System.NullReferenceException: Object 
reference not set to an instance of an object.
at MyProject.Program..cctor()
--- End of inner exception stack trace ---
at MyProject.Program.Main(String[] args)

I am also seeing a modal dialog window with the following error message:

MyProject has stopped working. 
A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available

I am confused by what Program..cctor() actually means. Please help!

0 answers

Too many commands? Learning new syntax?

FavScripts.com is a free tool to save your favorite scripts and commands, then quickly find and copy-paste your commands with just few clicks.

Boost your productivity with FavScripts.com!

Post Answer