TypeInitializationException thrown for Program class

后端 未结 13 846
醉梦人生
醉梦人生 2020-12-10 23:30

My Windows Forms application was working earlier, however suddenly it stopped working. I am getting following exception:

13条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-11 00:11

    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.

提交回复
热议问题