473,385 Members | 1,521 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,385 software developers and data experts.

Error running app but not while debugging!

Help please! .NET 2.0.

I have a hashtable defined:

public static Hashtable Params;

It currently is in a shared class in my app. I have moved it from the
main form to the shared class but get the same results no matter what.

When I run the app within VS it works fine! But when I run it outside
of VS I get "object reference is not set to an instance of an object"
and it is the Params.

Any ideas how this could be?
--

Don Gollahon
Jan 7 '08 #1
7 1512
Hi,

could you post some code?
Also take a look in the deail of the exception , as the line # of where the
error occurred.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Don Gollahon" <do**********@nospam.acs-inc.comwrote in message
news:xn***************@news.microsoft.com...
Help please! .NET 2.0.

I have a hashtable defined:

public static Hashtable Params;

It currently is in a shared class in my app. I have moved it from the
main form to the shared class but get the same results no matter what.

When I run the app within VS it works fine! But when I run it outside
of VS I get "object reference is not set to an instance of an object"
and it is the Params.

Any ideas how this could be?
--

Don Gollahon

Jan 7 '08 #2
Could you give more explanation about it.

For instance, how do you intialize the Params member.
At what line of code do you get the error (you can get it by looking at the
stack trace of the error object.

- José

"Don Gollahon" <do**********@nospam.acs-inc.coma écrit dans le message de
news:xn***************@news.microsoft.com...
Help please! .NET 2.0.

I have a hashtable defined:

public static Hashtable Params;

It currently is in a shared class in my app. I have moved it from the
main form to the shared class but get the same results no matter what.

When I run the app within VS it works fine! But when I run it outside
of VS I get "object reference is not set to an instance of an object"
and it is the Params.

Any ideas how this could be?
--

Don Gollahon
Jan 7 '08 #3
Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

could you post some code?
Also take a look in the deail of the exception , as the line # of
where the error occurred.
I inserted a test line to make sure this is where the problem was and
it is. The following is in the Main() method:

Main.GetINISettings();
try
{
string vstr = SharedClass.Params["LOGSERVER"].ToString();
}
catch (Exception E1)
{
MessageBox.Show("Main Params: " + E1.Message);
throw (new Exception(E1.Message));
}
And here is the GetINISettings method:

private void GetINISettings()
{
if (System.IO.File.Exists(IniName))
{
FileStream vini = new FileStream(IniName, FileMode.Open);
StreamReader vsr = new StreamReader(vini);
String[] elements;
try
{
while (!vsr.EndOfStream)
{
string vstr = vsr.ReadLine();
elements = vstr.Split('=');
SharedClass.Params.Add(elements[0], elements[1]);
}
}
catch (Exception Ex)
{
vsr.Close();
vini.Close();
Environment.ExitCode = 9000;
throw (new Exception("Config file not found or invalid: " +
Ex.Message));
//MessageBox.Show("Config file not found or invalid. " +
Ex.Message, "Error", MessageBoxButtons.OK);
return;
};
if (vsr != null)
vsr.Close();
if (vini != null)
vini.Close();
}
}

--

Don Gollahon
Jan 7 '08 #4
Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

could you post some code?
Also take a look in the deail of the exception , as the line # of
where the error occurred.
I forgot to include this in the sample I sent. It is before the other
code in Main():

SharedClass.Params = new Hashtable();

--

Don Gollahon
Jan 7 '08 #5
Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

could you post some code?
Also take a look in the deail of the exception , as the line # of
where the error occurred.
Uhhh, nevermind.

I forgot to move the ini file to the working directory.

Good grief!

--

Don Gollahon
Jan 7 '08 #6
Hi,

Take a look at the ini file, must probably you are using a different version
when you are debugging

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Don Gollahon" <do**********@nospam.acs-inc.comwrote in message
news:xn***************@news.microsoft.com...
Ignacio Machin ( .NET/ C# MVP ) wrote:
>Hi,

could you post some code?
Also take a look in the deail of the exception , as the line # of
where the error occurred.

I inserted a test line to make sure this is where the problem was and
it is. The following is in the Main() method:

Main.GetINISettings();
try
{
string vstr = SharedClass.Params["LOGSERVER"].ToString();
}
catch (Exception E1)
{
MessageBox.Show("Main Params: " + E1.Message);
throw (new Exception(E1.Message));
}
And here is the GetINISettings method:

private void GetINISettings()
{
if (System.IO.File.Exists(IniName))
{
FileStream vini = new FileStream(IniName, FileMode.Open);
StreamReader vsr = new StreamReader(vini);
String[] elements;
try
{
while (!vsr.EndOfStream)
{
string vstr = vsr.ReadLine();
elements = vstr.Split('=');
SharedClass.Params.Add(elements[0], elements[1]);
}
}
catch (Exception Ex)
{
vsr.Close();
vini.Close();
Environment.ExitCode = 9000;
throw (new Exception("Config file not found or invalid: " +
Ex.Message));
//MessageBox.Show("Config file not found or invalid. " +
Ex.Message, "Error", MessageBoxButtons.OK);
return;
};
if (vsr != null)
vsr.Close();
if (vini != null)
vini.Close();
}
}

--

Don Gollahon

Jan 7 '08 #7
Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

Take a look at the ini file, must probably you are using a different
version when you are debugging
Yep. Actually, blush, I forgot to copy it to the working directory and
not just the development area.

--

Don Gollahon
Jan 8 '08 #8

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

Similar topics

10
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through...
4
by: Stephen Miller | last post by:
Hi, I am running v1.1.4322 on Win2K server and unable to debug a ASP.Net application running locally, using a full URL (ie www.mysite.com). When I hit F5, I get the following error message: ...
5
by: Don Hans | last post by:
Gents, Have .Net2003 Enterprise architect installed on a Win2k Server with IIS. Even logged in as administrator, I cannot run any ASP.NET app with debugging. I always get the error "Unable to...
0
by: Adam Getchell | last post by:
I'm attempting to write a custom Authentication module using http://www.15seconds.com/Issue/020417.htm I looked at http://support.microsoft.com/default.aspx?scid=kb;EN-US;307996, but it doesn't...
1
by: Ramanfromoz | last post by:
Hi, Developing a new we application. Everything okay on my local WIN XP PROFESSIONAL, IIS 5.0 running locally. The website is running smoothly. Now, the same code I am copying over to a...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Languageâ€, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
4
by: Nate | last post by:
I have the following ASP code on a simple "experimental" page: <% Set myMail=CreateObject("CDO.Message") myMail.Subject="Sending email with CDO" myMail.From="f...@blah.com"...
6
by: Miro | last post by:
I can run an exe ( and its install ) i have created on my machine. The exe has a button that populates a dataset and then shoots it to a crystal report. But... Installing the setup.exe on my...
4
by: Miro | last post by:
<i have also added this reply to the other newsgroup - now that I have realizd ( and assuming ) it is not a localized error directly to vb.> I have found this link on the website:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.