tags:

views:

179

answers:

6

I have a VB.NET site. At the top of many of my pages I have code such as this:

Partial Class _Default
    Inherits System.Web.UI.Page
    Dim fns As New Functions
    Dim bOnOff As Boolean
    Dim LNBs As New LimsNetBusiness.SiteUI.SiteUI
    Dim LNBu As New LimsNetBusiness.User.user
    Dim LNBp As New LimsNetBusiness.PasswordFunctions.Password

When I publish the site. I get "Object reference not set to an instance of an object." on line:

Dim LNBs As New LimsNetBusiness.SiteUI.SiteUI

Why? And how do I fix?

+1  A: 

You would need to show us the constructor of LimsNetBusiness.SiteUI.SiteUI I would assume.

Given that this problem only happens remotely, I'm thinking the constructor accesses an asset, connection or config file that isn't available on the server.

My recommendation is to open the DLL with Reflector and see what resources it accesses/other potentials for a null dereference.

Oddly you are saying there is no Sub New(), but I'm curious how you can create a variable of that type without having a constructor.

You mention that SiteUI passes through to your data layer - are you confident the data layer access is working fine remotely?

Graphain
if you want to request more information, you should probably post it as a comment to the question rather than as an answer.
Brandon
Inside my "DataAccess" Class, I was referencing a different Connection string in the WEB.CONFIG . . . . missing resource being correct. Thank you for your help
andrewWinn
Welcome, glad I could point you in the right direction.
Graphain
+1  A: 

Not enough info. Unfortunately LimsNetBusiness is not a .net namespace. I would suggest looking into the SiteUI constructor and see if you fail inside there.

Jonathan Kaufman
+1  A: 

Is LimsNetBusiness a seperate DLL? Did you publish that too?

jao
yes it is a seperate DLL, and yes it is published too.
andrewWinn
A: 

Does LimsNetBusiness.SiteUI.SiteUI reference a table, or perhaps web.config file? Maybe a table row was deleted or something similar.

Jim
it is really nothing more than a pass through for the LimsNetData DLL
andrewWinn
A: 

This is a NullReferenceException Some where along the way a NullReferenceException is occurring.

Now you didn't provide enough information about what LimsNetBusiness is but if I had to guess:

  • Since I can't see you stack trace, you should be aware of the fact that the exception might be contained in the code that is instantiated in the constructor of LimsNetBusiness.SiteUI.SiteUI
  • If LimsNetBusiness.SiteUI is a static Property, you will need to make sure that you instantiate the returned object.
Chris
A: 

It's possible that the error is occuring in the initialization of LNBs. Since that happens in the dim statement, you probably won't see the location of the error if this is true. You can try moving the initialization of LNBs to an assignment statement:

Dim LNBs As LimsNetBusiness.SiteUI.SiteUI
LNBs = new LimsNetBusiness.SiteUI.SiteUI

Also, check in the initialization of LimsNetBusiness.SiteUI.SiteUI and make sure there is a "new" everywhere that there should be.

xpda