473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

why System.ArgumentNullException'

Greetings, experts!

I'm having a bit of a problem importing some working code from last
night into Visual Studio. The code compiles correctly, but when I run
the program, it doesn't seem to open the text window to ask for input.
It simply errors on the ReadLine statement. (See the attached code.)

When I use "Start Without Debugging", I received an exception window
that says "An exception 'System.ArgumentNullException' has occurred in
CSharp2.exe". It then gives me the option to debug. ("Do you want to
debug using the selected debugger?") When I press the "Yes" button, the
program shows the error on the line "double radius = double.Parse
(Console.ReadLine());"

I speculate that this is some configuration problem with my local
environment, but (after much searching) I can't find any.

Do you have any ideas on this one?

Thank you!

Dave

here's the source-code:

using System;

namespace CSharp2 {
public class GetArea {
static void Main(string[] args) {
Console.Write("Radius: ");
double radius = double.Parse(Console.ReadLine());
while (radius != 0) {
double area = radius * Math.PI;
Console.WriteLine("With radius = " + radius + ", Area =
" + area);
Console.Write("Radius: ");
radius = double.Parse(Console.ReadLine());
} // while (radius != 0)
} // static void Main
} // public class GetArea
} //namespace CSharp2

Nov 17 '05 #1
3 4210
Hello

If you are trying to import some code from the last NIGHT, then may be you
just missed the "Output Type" property of your project ? Try to check that
it is set to "Console Application". Because the described error is a symptom
of "Window Application" set in output type.


--
With best regards,
Andrew

http://www.codeproject.com/script/pr...asp?id=1181072
"davesNotHere" <me@here.org> wrote in message
news:MP************************@news.verizon.net.. .
Greetings, experts!

I'm having a bit of a problem importing some working code from last
night into Visual Studio. The code compiles correctly, but when I run
the program, it doesn't seem to open the text window to ask for input.
It simply errors on the ReadLine statement. (See the attached code.)

When I use "Start Without Debugging", I received an exception window
that says "An exception 'System.ArgumentNullException' has occurred in
CSharp2.exe". It then gives me the option to debug. ("Do you want to
debug using the selected debugger?") When I press the "Yes" button, the
program shows the error on the line "double radius = double.Parse
(Console.ReadLine());"

I speculate that this is some configuration problem with my local
environment, but (after much searching) I can't find any.

Do you have any ideas on this one?

Thank you!

Dave

here's the source-code:

using System;

namespace CSharp2 {
public class GetArea {
static void Main(string[] args) {
Console.Write("Radius: ");
double radius = double.Parse(Console.ReadLine());
while (radius != 0) {
double area = radius * Math.PI;
Console.WriteLine("With radius = " + radius + ", Area =
" + area);
Console.Write("Radius: ");
radius = double.Parse(Console.ReadLine());
} // while (radius != 0)
} // static void Main
} // public class GetArea
} //namespace CSharp2

Nov 17 '05 #2
i am not sur if the problem is the output type. I think you are getting a
null value from the console.

try using

string s = Console.ReadLine();

if(s.TrimEnd(null) && s.Length > 0)
try
{
Double p = double.Parse(s);
}
catch(Exception e)
{

}
"davesNotHere" <me@here.org> wrote in message
news:MP************************@news.verizon.net.. .
Greetings, experts!

I'm having a bit of a problem importing some working code from last
night into Visual Studio. The code compiles correctly, but when I run
the program, it doesn't seem to open the text window to ask for input.
It simply errors on the ReadLine statement. (See the attached code.)

When I use "Start Without Debugging", I received an exception window
that says "An exception 'System.ArgumentNullException' has occurred in
CSharp2.exe". It then gives me the option to debug. ("Do you want to
debug using the selected debugger?") When I press the "Yes" button, the
program shows the error on the line "double radius = double.Parse
(Console.ReadLine());"

I speculate that this is some configuration problem with my local
environment, but (after much searching) I can't find any.

Do you have any ideas on this one?

Thank you!

Dave

here's the source-code:

using System;

namespace CSharp2 {
public class GetArea {
static void Main(string[] args) {
Console.Write("Radius: ");
double radius = double.Parse(Console.ReadLine());
while (radius != 0) {
double area = radius * Math.PI;
Console.WriteLine("With radius = " + radius + ", Area =
" + area);
Console.Write("Radius: ");
radius = double.Parse(Console.ReadLine());
} // while (radius != 0)
} // static void Main
} // public class GetArea
} //namespace CSharp2

Nov 17 '05 #3
In article <#n*************@tk2msftngp13.phx.gbl>,
an*************@gmail.com says...
Hello

If you are trying to import some code from the last NIGHT, then may be you
just missed the "Output Type" property of your project ? Try to check that
it is set to "Console Application". Because the described error is a symptom
of "Window Application" set in output type.


Thank you, my friend. That did it.

Best Regards,
Dave
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MJB | last post by:
I'm getting an IStream back from function xmlHttp.responsestream. I would like to convert this to a System.IO.Stream in order to work with it in my application. Has anyone encountered this and...
3
by: Bisbal | last post by:
Hi, I'd like to know if it is possible to create a form type from a string. My case: I have a DataTable with forms names (i.e frm_001_UserInfo.cs), and I'd like to create an instance of that...
0
by: Joachim | last post by:
When trying to connect clientSocket.Connect(new IPEndPoint(new IPAddress(ipOctets), port)); I get a System.ArgumentException (not a ArgumentNullException) saying "address". What is wrong? I...
5
by: hzgt9b | last post by:
I'm building a dataset that writes out a Point type value. Here's the code that I've got: 1 Dim dsContent As DataSet = New DataSet("content") 2 Dim dtAsset As DataTable = New...
1
by: florinake | last post by:
The following error occurs when I want to make a relation between two tables : "System.ArgumentNullException: 'column' argument cannot be null" . The code where appears the exception: ...
2
by: Claire | last post by:
I'm a noob at emailing from code and I need to add email capabilities to my application. The following code completes without exceptions but I'm not receiving any test emails. How do you debug...
0
by: pankajprakash | last post by:
Hi all I am using the Ajax control toolkit and want to the fill the gridview but at the time of rendering it occurs the error "Sys.ArgumentNullException: Value cannot be null. Parameter name:...
2
by: Tom C | last post by:
This error occurs erratically at startup. It appears to be all native code. Does anyone have any idea what the heck could be cauing this? System.ArgumentNullException: Value cannot be null....
5
by: Henry Stock | last post by:
I am trying to understand the following error: Any thing you can tell me about this is appreciated. Security Exception Description: The application attempted to perform an operation not allowed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.