Groups | Blog | Home
all groups > dotnet clr > july 2005 >

dotnet clr : Why Dispose() method cause error "Object reference not set to an .


samer79y
7/19/2005 7:23:02 AM
Dear All,

I just need an answer of why the Dispose() method cause this error "Object
reference not set to an instance of an object"

I built server control component and use Sharepoint Object Model to
retrieve the sites and arrange them in menu. I have used object like: SPWeb
and SPSite. When I dispose these object and at runtime this error appear to
me.

Jon Skeet [C# MVP]
7/19/2005 7:08:40 PM
[quoted text, click to view]

First, check that you're calling Dispose on valid references - if the
variable you're calling Dispose on is null, then you'll get that
exception.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
Javier Martinez
8/17/2005 12:00:00 AM
Hi
Who is invoking the dispose of your orbject? If is the Finalize method
(destructor) you never must call dispose becaus may be that object has been
previously disposed. There ins't any order in the call of dispose

"samer79y" <samer79y@discussions.microsoft.com> escribió en el mensaje
news:C1AD04D6-E8B3-4A66-912C-843ED4BE3162@microsoft.com...
[quoted text, click to view]

AddThis Social Bookmark Button