ObjectDisposedException

H

HW

Hi, I'm seeing an ObjectDisposedException inside the Watch variable
of my FileStream object, the code is here dead simple when i Close the
Filestream object it doesn't get set to Nothing although the BinaryReader
object does get set to Nothing, what's wrong?

Dim FS As System.IO.FileStream
Dim BR As System.IO.BinaryReader

FS = File.OpenRead("Image.udb")

BR = New BinaryReader(FS)

Data = BR.ReadBytes(Length)

-------

FS.Close() Inside FS watch variable see ObjectDisposedException and FS is
NOT nothing

BR.Close() BR set to Nothing after this
 
H

HW

Sorry, i'm wondering why i am seeing an ObjectDisposedException
when i close the FS object. When i have FS set as a watch variable
in the debugger i see the exception inside the variable and it dosen't get
set to Nothing and is still pointing to an object after executing FS.Close
statement.

The BR object is correctly disposed. SO i'm wondering why the FS object
is not correctly disposed. The code looks ok to me.
 
H

HW

It is getting thrown as inner exception. How does one go about
solving inner exceptions?
 

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