Today is my first day learning C#. I am experienced with Java and C and usually don't run into problems I cant solve. I have always dreaded using Visual Studio due to the never ending errors I would receive when I use to run my assembly programs. Today I wanted to just run a simple hello world
program. After running the program, I am getting the following errors.
'dotnet.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\cansh_000\source\repos\Program\Program\bin\Debug\netcoreapp2.0\Program.dll'. Symbols loaded. 'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Console.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Runtime.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The program '[2852] dotnet.exe' has exited with code 0 (0x0).`
Code down Below
using System;
namespace Program
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
}
Any help would be appreciated
None of that output is an error message. It says your program ran to completion successfully and then exited. The C# compiler does not add a "Press any key to continue..." message after the program completes unlike some C compilers - so after the program runs it disappears leaving no-trace on screen.
Look for your void Main
, int Main
, (or async Task Main
) method and add Console.WriteLine("done!"); Console.ReadLine();
immediately before the closing curly brace }
.
Since C# 8.0 in VS2019, the IDE now does run console-mode applications using a special host process that will add the "Press any key to continue..." message after the program has finished running.
These aren't errors, they are just messages, showing that module XY was loaded. They can be very distracting from the debug messages you actually want to see.
If they disturb you (like me!) and you just want to turn off those messages in Visual Studio, there are two ways to do that:
1st Way to disable it
Go to Tools -> Options, type "debugging" into the search box, navigate to the "Output Window" settings and turn "Module Load Messages" Off.
The screenshot below illustrates how find the setting:
2nd Way to disable it
In the Debug Output Window, right-click to bring up the context menu, then un-tick the option as shown below:
Note: I also turned the Thread Exit Messages off - together with the option above it reduces the noise in the output window significantly!
As said before your program runs fine. The output window is just closed on exit.
The info messages you posted mean, that you are currently only debugging your own code (Console.WriteLine("Hello World");
) and no framework code.
This is the 'Just my Code' setting. You can change this under Tools>Options>Debugging>General>Enable Just my Code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With