My Simpe Hello World Console Application Exites With NONZERO EXIT CODE: 0xc000041d

-4

My friend is starting to learn C# using Visual Studio 2015 and I'm helping him. After we wrote a simple hello world console application (below) it did not run at all.

static void Main(string[] args)
{
    Console.WriteLine("Hi World");
    Console.ReadKey(false);
}

After I click the run button, it began to show diagnostic diagrams for a couple of seconds, but after that, exited the execution without showing console. I looked up at output window and I saw this error:

The Program 'loblobloblob' Has Exited With Code -1073740771 (0xc000041d).

What might be the cause of this?

c#
console-application
asked on Stack Overflow Feb 9, 2017 by Mohammadreza Rezaei • edited Feb 9, 2017 by Metoniem

1 Answer

3

There is nothing wrong with the code you posted.

  • Restart VS2015 (as regular user, no need for admin privileges)
  • Create a new Console Application project. Name it "MyFirstProgram", or something reasonable

Ensure that your Program.cs looks as follows:

using System;

namespace MyFirstProgram
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, World!");
            Console.ReadKey(false);
        }
    }
}

If this doesn't work, there is something wrong with your VS2015 installation.

answered on Stack Overflow Feb 9, 2017 by CoolBots

User contributions licensed under CC BY-SA 3.0