Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am taking a class on Udemy and ran into this. The instructor's video doesn't have this happen. Our code is the same. He is using VS2017 and I'm using VS2019.

Why does this error occur in the output?
Hello World!

C:\Program Files\dotnet\dotnet.exe (process 11588) exited with code 0.
Press any key to close this window . . .


C#
using System;

class EntryPoint
{
    static void Main()
    {
        Console.WriteLine("Hello World!");
    }
}


What I have tried:

Clean install of Windows 10 Pro with .NET 4.8
https://i.imgur.com/szG1DfW.png[^]
https://i.imgur.com/UwaO28z.png[^]
https://i.imgur.com/oIQ1YBj.png[^]
Posted
Updated 7-Jul-19 10:32am

1 solution

That "exit with ..." line is not part of your code. What your code does, is printing "Hello World!" and exiting. The rest of what you see, both the "exited with ..." line and the "Press any key ...", is part of the "Visual Studio Debug Console", which you seem to be using to run your program, based on your screenshot. It just prints out that the process exited with error code 0 (0 meaning "no error") as debug information.

If you'd open your program by opening Windows Explorer, go to the folder containing your program, and double-click on it to run it, you'd just see this: a program printing "Hello World!" and immediately exiting.
 
Share this answer
 
Comments
Member 13696377 7-Jul-19 16:37pm    
Thanks for your advice!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900