C# Console Application - cmd.exe hangs

狂风中的少年 提交于 2021-02-19 03:33:09

问题


I am having issues with running a simple C# Console Application in Visual Studio 2013.

Details of my problem: I was running Console Applications successfully with the default "Press any key to continue" displaying cleanly at the end. Suddenly it started behaving differently with the following symptoms:

  • A new command window (cmd.exe) opening alongside my Console Application (this wasn't happening in the past)

  • My Console Application closing abruptly without the default clean "Press any key" message

  • cmd.exe hangs and I am unable to close it, even through the Task Manager -> End Process

My System Properties:

  • Visual Studio 2013 Ultimate
  • Windows 8, x64

This is my Console Application code just to show that it isn't a problem in my code:

class Program
{
        static void Main(string[] args)
        {
            RegularTest();      
        }
        private static void RegularTest()
        {
            Console.WriteLine("This is the Regular Test. It works!");
        }
}

回答1:


We had the exact same problem here during several weeks ! And we finally found a solution !

In our case, it was the anti-virus Avast which was corrupting the generated .exe !

The solution was to simply disable all agents while generating the release !

If you use another anti-virus, try to disable it.



来源:https://stackoverflow.com/questions/20750084/c-sharp-console-application-cmd-exe-hangs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!