473,848 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot locate source of "Object reference not set to an instance of an object."

Hello,

I've been banging my head against the wall for a few days on this.

When I run a page, either in "View in Browser" or I actually build the
solution, I occasionally and very randomly get the following message:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullRefe renceException: Object reference not set
to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

When I set the Debugger to break during Exceptions, it breaks before any
code and just showed me some assembly-language looking stuff (I certainly
don't know about this).

I tried making a completely new solution, and bit-by-bit figure out where
the error is occurring. This started off OK, and I have a general idea where
it may be, but I am still having a problem pinpointing it.

Could anyone kindly give some suggestions on finding the problem?

Thanks so much.


Jan 3 '06 #1
1 2297
Gummy,
what you are missing is a way to handle unhandled exceptions and do
something useful. Consider:

ASP.NET : GetLastError Handler:
// in global.asax:
protected void Application_Err or(Object sender, EventArgs e)
{
ExceptionHandle r.LogException exc = new ExceptionHandle r.LogException( );
Exception ex = Server.GetLastE rror().GetBaseE xception();
// pass ex to your logging or notification utility
}

Your loggin utiity could be as simple as a text file or the Event Log, I
leave that implementation up to you. Make sure you capture the StackTrace as
that is where the exact line of code where things "blew up" is identified.
Good luck!
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Gummy" wrote:
Hello,

I've been banging my head against the wall for a few days on this.

When I run a page, either in "View in Browser" or I actually build the
solution, I occasionally and very randomly get the following message:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullRefe renceException: Object reference not set
to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

When I set the Debugger to break during Exceptions, it breaks before any
code and just showed me some assembly-language looking stuff (I certainly
don't know about this).

I tried making a completely new solution, and bit-by-bit figure out where
the error is occurring. This started off OK, and I have a general idea where
it may be, but I am still having a problem pinpointing it.

Could anyone kindly give some suggestions on finding the problem?

Thanks so much.


Jan 3 '06 #2

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

Similar topics

0
1635
by: Etienne Charland | last post by:
I have a DataSource and a DataMember (like with standard bindings). Now, I want to write a function that gets the source object from them. So, let's say DataSource is a dataset and DataMember is "MyTable.Col1", I want to return MyDataSet.Tables("MyTable") I decompiled BindingContext and CurrencyManager classes to see how it can be done, and from what I understand, it is done with the TypeDescriptor class, like this: DataSet ds = new...
5
4083
by: TC | last post by:
Hello, Here is what I'm trying to do: -- Make sure both MS Excel and MS Word are running -- Create an Excel chart -- Save the Excel file -- Copy the Excel chart onto the clipboard using Ctrl + C -- Go to Word and look under Edit > Paste Special -- Note there is a source reference and an option to paste the chart as a
8
13296
by: dixie | last post by:
I have a report with a subreport. The source object for this subreport varies according to the value of a field in a table. I am trying to programmatically set the object source for the subreport as part of the detail format section of the report. I have been playing around with things like: Me.SubReport.SourceObject = Report.sub5O5L but nothing seems to work. Can I achieve what I want to do and if so, can anyone give me the...
3
5375
by: Dave | last post by:
Greetings, I have a user control in my web form. I cannot reference it in code. My HTML File has the header: <%@ Register TagPrefix="PLB" Tagname="PIPSidebar" src="ProjectListSidebar.ascx" %> and references the User Control... <PLB:PIPSIDEBAR id="PIPSIDEBAR1" runat="server"></PLB:PIPSIDEBAR>
18
28764
by: Microsoft | last post by:
When I try this in my code I alwas get an errormessage: "Object reference not set to an instance of an object" Dim g As System.Drawing.Graphics g.DrawString("Test", New Font("Arial", 12, FontStyle.Bold), Brushes.Black, 0, 0) Why is this? Marc
5
5856
by: sparks | last post by:
I have a form that is broken down into 24 sub forms. these are all tied to one subform, they are filtered based on other things. But I need to change the sub forms source object based on a selection. I was going to try this.. For Each doc In dbs.Containers("Forms").Documents frmname = doc.Name
0
1072
by: Looch | last post by:
Hi All, I'm using Web Developer 2005 Express and when I add a new class to either the App_Code or App_Data directories I cannot reference the class through intellisense. I've tried saving the project and even restarted Web Dev and still nothing. Am I missing something? Thanks in advance.
4
2185
by: My Pet Programmer | last post by:
Ok guys, I'm really looking for someone to tell me how bad a hack this is, and if I'm close to where I should be with it. The basic situation is that I have a class which creates a basic calendar control, the only difference is I stole the navigation scheme from Vista (e.g., if you click on the year you zoom out to the months list, then out to the decade, and back in when you click a year, then a month). I ran into some trouble...
12
18286
by: Jordi | last post by:
I'm getting the following error: Software error: Can't locate object method "new" via package "A::B" at /path/file.cgi line 5. My code is basically this: #!/usr/bin/perl -w use strict; use warnings; use A::B; my $test = new A::B;
0
9735
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10347
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7889
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7062
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5730
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5915
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4541
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4133
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3171
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.