visual studio debugger message

J

Jon Paal

anybody know what causes this error message reported by visual studio just in tiime debugger ?

I get it when trying to populate a simple gridview from a datareader. Running locally, the code compiles, but after the page
renders, I get the debugger popping up and it gives me the following error message


"an unhandled exception('System.NullReferenceException') occurred in aspnet_wp_exe "
 
J

Juan T. Llibre

It means that the compiler found a null value where an object instance was required.
Find the part of your code which is expecting a reference value it isn't getting.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
 
M

Mark Fitzpatrick

Check the trace log for the web app to see if more detailed info is there.
Without knowing your code exactly, here's a possible scenario. You have a
function or block of code that fetches the datareader. For some reason the
database code bombs out and leaves a datareader that's not fully
initialized, hence is null. When you set the datareader as the datasource
and attempt to bind to it, it's a null value, not an empty datareader, but a
null value instead since the datareader wasn't initialized fully.
 
J

Jon Paal

but the page renders as expected....
The page trace shows no errors on the page.

The error message appears well after all is completed.

== code =====
Dim users as New DBClass
DisplayGrid.DataSource=users.Return_Reader("SELECT name, email FROM users_profile")
DisplayGrid.DataBind()

Public Class DBClass
Function Return_Reader(ByVal strSQL As String)
....
DBReader = Query.ExecuteReader(system.data.CommandBehavior.CloseConnection)
Return DBReader
end functon
end class
 
M

Mark Fitzpatrick

Why don't you try to test the DBReader to see if it's null before setting
the datasource to it. That may give you an idea of whether or not it is
actually returning any results. That's one of the key things to keep in mind
when depending upon any variable, you have to test to ensure it isn't null
before it's manipulated or consumed in some fashion. If you're testing to
see if it's null first, then you could trap the null and handle it
gracefully without receiving the error.
 
J

Jon Paal

getting more errors ---

now showing "aspnet_wp.exe (PID#) stopped unexpectedly."

Event Type: Error
Event Source: ASP.NET 2.0.50727.0
Event Category: None
Event ID: 1000
Date: 10/22/2006
Time: 2:58:57 PM
User: N/A
Computer: *************
Description:
aspnet_wp.exe (PID#) stopped unexpectedly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top