473,326 Members | 2,173 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,326 software developers and data experts.

Can't call objects in my business layer from a console application in my solution.

I am getting a error that should not be happening when I instantiate an
object from my business layer in a console application within my solution.

I get an "object reference not set to an instance of an object." I checked
my references and the dll's are there. I have my namespace right and I even
get intellisense to work. I don't get this error anywhere else in my
solution when calling objects in different projects.

Does anyone have any idea what is going on? I have run out of things to
check.

Thanks.

Mike
Nov 17 '05 #1
6 1555

Mike Malter wrote:
I am getting a error that should not be happening when I instantiate an object from my business layer in a console application within my solution.
I get an "object reference not set to an instance of an object." I checked my references and the dll's are there. I have my namespace right and I even get intellisense to work. I don't get this error anywhere else in my solution when calling objects in different projects.

Does anyone have any idea what is going on? I have run out of things to check.

Thanks.

Mike


Can you post the offending piece of code?

Neil

Nov 17 '05 #2
Neil,

Here is a snippet:

using Ripple.Common;

using Ripple.Home.BusinessLayer;

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Collections.Specialized;

using System.EnterpriseServices;

namespace Ripple.Home.RemotaDataCollection

{

/// <summary>

/// Summary description for Collector.

/// </summary>

class Collector

{

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

//string x = ConfigurationSettings.AppSettings["Whatever"];

try

{

int ServerID = (int) ServerIDConstant.None;

int ServerTypeID = (int) ServerTypeIDConstant.None;

int Active = 0;

string WebServiceURL = string.Empty;

DataTable dtServer = new DataTable();

BusinessLayer.Server server = new BusinessLayer.Server(); <=== BREAKS
HERE.

/*

* Check for rows.

*/

dtServer = server.ListAll();

if (dtServer.Rows.Count > 0)

{

.... END OF SNIPPET == == == == == ==
"NWeller" <ne*********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

Mike Malter wrote:
I am getting a error that should not be happening when I instantiate

an
object from my business layer in a console application within my

solution.

I get an "object reference not set to an instance of an object." I

checked
my references and the dll's are there. I have my namespace right and

I even
get intellisense to work. I don't get this error anywhere else in my

solution when calling objects in different projects.

Does anyone have any idea what is going on? I have run out of things

to
check.

Thanks.

Mike


Can you post the offending piece of code?

Neil

Nov 17 '05 #3
Hi Mike,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you're getting a NullReferenceException
when trying to instantiate a BusinessLayer.Server object. If there is any
misunderstanding, please feel free to let me know.

Based on the code snippet you have provided, I didn't see anything wrong if
the program breaks on this line.

BusinessLayer.Server server = new BusinessLayer.Server();

So most probably, the exception is thrown from the Server class
constructor. Could you let me know if you're referencing the assembly DLL
in your program or referencing the project? If you have the project of
business layer, you can try to trace into the constructor code to see what
is going wrong.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #4
If that truely is the line that blows up (have you tried putting Console.WriteLine just before and after? the debugger smetimes reports the wrong line), then I would suspect that the ctor of Server is blowing up. do you have a full stack trace from the exception object?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Neil,

Here is a snippet:

using Ripple.Common;

using Ripple.Home.BusinessLayer;

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Collections.Specialized;

using System.EnterpriseServices;

namespace Ripple.Home.RemotaDataCollection

{

/// <summary>

/// Summary description for Collector.

/// </summary>

class Collector

{

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

//string x = ConfigurationSettings.AppSettings["Whatever"];

try

{

int ServerID = (int) ServerIDConstant.None;

int ServerTypeID = (int) ServerTypeIDConstant.None;

int Active = 0;

string WebServiceURL = string.Empty;

DataTable dtServer = new DataTable();

BusinessLayer.Server server = new BusinessLayer.Server(); <=== BREAKS
HERE.

/*

* Check for rows.

*/

dtServer = server.ListAll();

if (dtServer.Rows.Count > 0)

{

... END OF SNIPPET == == == == == ==
"NWeller" <ne*********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

Mike Malter wrote:
I am getting a error that should not be happening when I instantiate

an
object from my business layer in a console application within my

solution.

I get an "object reference not set to an instance of an object." I

checked
my references and the dll's are there. I have my namespace right and

I even
get intellisense to work. I don't get this error anywhere else in my

solution when calling objects in different projects.

Does anyone have any idea what is going on? I have run out of things

to
check.

Thanks.

Mike


Can you post the offending piece of code?

Neil


[microsoft.public.dotnet.languages.csharp]
Nov 17 '05 #5
The problem was me.

I was referring to a setting in a config file that did not exist and the call just
died.

"Richard Blewett [DevelopMentor]" <ri******@NOSPAMdevelop.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
If that truely is the line that blows up (have you tried putting Console.WriteLine
just before and after? the debugger smetimes reports the wrong line), then I would
suspect that the ctor of Server is blowing up. do you have a full stack trace from
the exception object?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Neil,

Here is a snippet:

using Ripple.Common;

using Ripple.Home.BusinessLayer;

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Collections.Specialized;

using System.EnterpriseServices;

namespace Ripple.Home.RemotaDataCollection

{

/// <summary>

/// Summary description for Collector.

/// </summary>

class Collector

{

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

//string x = ConfigurationSettings.AppSettings["Whatever"];

try

{

int ServerID = (int) ServerIDConstant.None;

int ServerTypeID = (int) ServerTypeIDConstant.None;

int Active = 0;

string WebServiceURL = string.Empty;

DataTable dtServer = new DataTable();

BusinessLayer.Server server = new BusinessLayer.Server(); <=== BREAKS
HERE.

/*

* Check for rows.

*/

dtServer = server.ListAll();

if (dtServer.Rows.Count > 0)

{

... END OF SNIPPET == == == == == ==
"NWeller" <ne*********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

Mike Malter wrote:
I am getting a error that should not be happening when I instantiate

an
object from my business layer in a console application within my

solution.

I get an "object reference not set to an instance of an object." I

checked
my references and the dll's are there. I have my namespace right and

I even
get intellisense to work. I don't get this error anywhere else in my

solution when calling objects in different projects.

Does anyone have any idea what is going on? I have run out of things

to
check.

Thanks.

Mike


Can you post the offending piece of code?

Neil


[microsoft.public.dotnet.languages.csharp]

Nov 17 '05 #6
It was nice to hear that you have had the problem resolved. Thanks for
sharing your experience with all the people here. If you have any
questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #7

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

Similar topics

2
by: headware | last post by:
I am new to 3-tiered design and am in the process of designing an application that will work with ASP.NET as well as Windows Forms (and possibly with a PDA of some sort down the road). My question...
5
by: Ray Stevens | last post by:
I have a C# dataclass object that I would like to pass to a Web Service WebMethod, modify some strings, and return it to the caller but I am getting compiler errors in the client. I'm not an expert...
8
by: Techno_Dex | last post by:
Has anyone come up with a slick way to make Custom Serializable Objects to behave like DataSets when using WebServices? What I'm looking for is some way to force the WSDL generated code to create...
6
by: Dave Harvey | last post by:
I have developed a standard .NET control which displays medical images and works fine in applications, but increasingly, my customers are wishing to use it in an ASP.NET environment, so I am...
3
by: olduncleamos | last post by:
Hi all, What is, in general, the preferred practice to transfer data between business objects and the data layer? To be more specific, I have a couple of business objects with state data that...
6
by: Guy Thornton | last post by:
I have an application in asp.net using vb. The asp.net portion of this application is mainly the user interface. The UI has references made to our business logic layer. And the business logic...
25
by: Penelope Dramas | last post by:
Hello, I'm in a front of very serious .net redesign/rewrite of an old VB6 application. I had been asked to make it .NET 2.0 and would like to ask couple of questions regarding data access as...
8
by: rpsetzer | last post by:
I have to create a big web application and I was thinking of using a data layer. For each entity in the database, I'll define a class that maps the table structure, having sub-objects for each...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.