C# Error

A

Andrew Banks

I'm trying a simple application and keep getting the following debug
information when I try and run the application. The console window simply
opens then closes in an instant.

Does anyone have any ideas please?

The Code
-----------------------
/*
Project 1-1
This program converts Fahrenheit to Celsius
*/

using System;

class FtoC{
public static void Main(){
double f;
double c;
f= 59.0;
c= 5.0 / 9.0 * (f - 32.0);
Console.Write(f + " degrees fahranheit is ");
Console.WriteLine(c + " degrees celsius.");
}
}

The Debug Message
------------------------
'DefaultDomain': Loaded
'c:\windows\microsoft.net\framework\v1.0.3705\mscorlib.dll', No symbols
loaded.
'Project1': Loaded 'C:\Documents and Settings\Andrew Banks\Desktop\C#
Book\Project1\bin\Debug\Project1.exe', Symbols loaded.
The program '[3788] Project1.exe' has exited with code 0 (0x0).
 
F

Fred Mellender

try adding: Console.ReadLine() at the end, in order to keep the console
open. When you hit return in the console the program will end and the
console window will be closed.

Alternatively, run your program from a command line in a Command Prompt
window (%SystemRoot%\system32\cmd.exe) and the output will be to that
console.
 
A

Andrew Banks

Thanks Fred,

I though it may be something to do with the program finishing and closing
the console but being new to the whole .NET/C#/Microsoft programming game I
couldn't be sure.

I'll try your suggestions tomorrow as it's getting late here and feed back
here.


Fred Mellender said:
try adding: Console.ReadLine() at the end, in order to keep the console
open. When you hit return in the console the program will end and the
console window will be closed.

Alternatively, run your program from a command line in a Command Prompt
window (%SystemRoot%\system32\cmd.exe) and the output will be to that
console.


Andrew Banks said:
I'm trying a simple application and keep getting the following debug
information when I try and run the application. The console window simply
opens then closes in an instant.

Does anyone have any ideas please?

The Code
-----------------------
/*
Project 1-1
This program converts Fahrenheit to Celsius
*/

using System;

class FtoC{
public static void Main(){
double f;
double c;
f= 59.0;
c= 5.0 / 9.0 * (f - 32.0);
Console.Write(f + " degrees fahranheit is ");
Console.WriteLine(c + " degrees celsius.");
}
}

The Debug Message
------------------------
'DefaultDomain': Loaded
'c:\windows\microsoft.net\framework\v1.0.3705\mscorlib.dll', No symbols
loaded.
'Project1': Loaded 'C:\Documents and Settings\Andrew Banks\Desktop\C#
Book\Project1\bin\Debug\Project1.exe', Symbols loaded.
The program '[3788] Project1.exe' has exited with code 0 (0x0).
 
K

Kailey Joanette

You may be RUNNING instead of debugging. Running tends to cause the program
to exit immediately. DEBUGGING tends to have a "press any key to continue
prompt"...check and make sure you're running a debug sessions and not a run.

Cheers,
Kailey
 
A

Andrew Banks

I am running but I get the same thing with debug set as well

Kailey Joanette said:
You may be RUNNING instead of debugging. Running tends to cause the program
to exit immediately. DEBUGGING tends to have a "press any key to continue
prompt"...check and make sure you're running a debug sessions and not a run.

Cheers,
Kailey
Andrew Banks said:
I'm trying a simple application and keep getting the following debug
information when I try and run the application. The console window simply
opens then closes in an instant.

Does anyone have any ideas please?

The Code
-----------------------
/*
Project 1-1
This program converts Fahrenheit to Celsius
*/

using System;

class FtoC{
public static void Main(){
double f;
double c;
f= 59.0;
c= 5.0 / 9.0 * (f - 32.0);
Console.Write(f + " degrees fahranheit is ");
Console.WriteLine(c + " degrees celsius.");
}
}

The Debug Message
------------------------
'DefaultDomain': Loaded
'c:\windows\microsoft.net\framework\v1.0.3705\mscorlib.dll', No symbols
loaded.
'Project1': Loaded 'C:\Documents and Settings\Andrew Banks\Desktop\C#
Book\Project1\bin\Debug\Project1.exe', Symbols loaded.
The program '[3788] Project1.exe' has exited with code 0 (0x0).
 
A

Andrew Banks

Thanks Fred, that worked fine

Fred Mellender said:
try adding: Console.ReadLine() at the end, in order to keep the console
open. When you hit return in the console the program will end and the
console window will be closed.

Alternatively, run your program from a command line in a Command Prompt
window (%SystemRoot%\system32\cmd.exe) and the output will be to that
console.


Andrew Banks said:
I'm trying a simple application and keep getting the following debug
information when I try and run the application. The console window simply
opens then closes in an instant.

Does anyone have any ideas please?

The Code
-----------------------
/*
Project 1-1
This program converts Fahrenheit to Celsius
*/

using System;

class FtoC{
public static void Main(){
double f;
double c;
f= 59.0;
c= 5.0 / 9.0 * (f - 32.0);
Console.Write(f + " degrees fahranheit is ");
Console.WriteLine(c + " degrees celsius.");
}
}

The Debug Message
------------------------
'DefaultDomain': Loaded
'c:\windows\microsoft.net\framework\v1.0.3705\mscorlib.dll', No symbols
loaded.
'Project1': Loaded 'C:\Documents and Settings\Andrew Banks\Desktop\C#
Book\Project1\bin\Debug\Project1.exe', Symbols loaded.
The program '[3788] Project1.exe' has exited with code 0 (0x0).
 
N

Nurchi BECHED

Hello, Kailey!
You wrote on Mon, 3 Nov 2003 21:02:56 -0500:

Actually, that ("press any key...") happens only in VC++...
In VB/C#/J# console applications there is no such thing...

KJ> You may be RUNNING instead of debugging. Running tends to cause the
KJ> program to exit immediately. DEBUGGING tends to have a "press any key
KJ> to continue prompt"...check and make sure you're running a debug
KJ> sessions and not a run.

KJ> Cheers,
KJ> Kailey
KJ> ??>> I'm trying a simple application and keep getting the following debug
??>> information when I try and run the application. The console window
??>> simply opens then closes in an instant. Does anyone have any ideas
??>> please? The Code ---------------- /* Project 1-1 This program converts
??>> Fahrenheit to Celsius */ using System; class FtoC{ public static
??>> void Main(){ double f; double c; f= 59.0; c= 5.0 /
??>> 9.0 * (f - 32.0); Console.Write(f + " degrees fahranheit is ");
??>> Console.WriteLine(c + " degrees celsius."); } } The Debug Message
??>> ------------------------
??>> 'DefaultDomain': Loaded
??>> 'c:\windows\microsoft.net\framework\v1.0.3705\mscorlib.dll', No
??>> symbols loaded. 'Project1': Loaded 'C:\Documents and Settings\Andrew
??>> Banks\Desktop\C# Book\Project1\bin\Debug\Project1.exe', Symbols
??>> loaded. The program '[3788] Project1.exe' has exited with code 0
??>> (0x0).


With best regards, Nurchi BECHED. E-mail: (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top