Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Basics (Retired) Console I/O Start Coding

Courtney Burgmann
Courtney Burgmann
443 Points

The program is not launching when I write mono Program.exe to the console it just returns a new console line

The program is not launching when I write mono Program.exe to the console it just returns a new console line

9 Answers

Steven Parker
Steven Parker
231,084 Points

Most likely your program is launching, but then ends without producing any output. If there had been a problem you would have seen an error message.

To facilitate a complete analysis, make a snapshot of your workspace and post the link to it here.

Shailendra kushwaha
Shailendra kushwaha
1,523 Points

The same problem happened to me, how can we solve this.

Steven Parker
Steven Parker
231,084 Points

I see you started a new question, now post a snapshot of your workspace there.

Steven Parker
Steven Parker
231,084 Points

This is a perfect example of what I suspected in my first answer. So, if we look at your program code:

class Program
{
    static void Main()
    {
    }
}

This is an "empty" program, it doesn't take in any input, and it doesn't produce any output.

So when you launch it, it will finish (successfully) and then you will get another console prompt.

Pitrov Secondary
Pitrov Secondary
5,121 Points

Its wierd, cause what i see in my workspace is this System.Console.Write("enter ur mins"); but this is not included in the snapshot, and i only have one file, I dont have Program.exe.

Steven Parker
Steven Parker
231,084 Points

The "Program.exe" file is created when you compile ("mcs"). And when you add code in the workspace editor, be sure to save your changes (with Ctrl-S or the "save" menu choice) before you compile.

Steven Parker
Steven Parker
231,084 Points

So do you see the output line when you compile and run it now?

Pitrov Secondary
Pitrov Secondary
5,121 Points

No, I do not see the output line.

Steven Parker
Steven Parker
231,084 Points

According to the snapshot, the program code was changed at 4:00 PM, but it was last compiled at 3:06. So the version you were running was compiled from a previous edit.

I just compiled it again ("mcs Program.cs") and then ran it ("mono Program .exe") and I did see the message.

make sure to save the file before you comple the code with mcs.

Daniel Green
Daniel Green
840 Points

try renaming the file, "Program.cs" to whatever you want and go thru the motions again. for some reason this worked for me.

Daniel Green
Daniel Green
840 Points

i ended up deleting all extra "cs" and "exe" files, closing workspaces, starting a new workspace and everything started working as it should in the video after this one. except the different error code numbers but the error description was the same.

I had the same issue at first. Then I think I found the solution in the comments:

1) Save the workspace code 2) Compile the workspace code 3) Run the workspace code via "mono Program.cs"

Steven Parker
Steven Parker
231,084 Points

You got it, "edit, save, compile, run".   And then "repeat as necessary". :wink: