PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
ObjectDisposedException
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
ObjectDisposedException
![]() |
ObjectDisposedException |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Try a little punctuation - I'm really not sure what you're saying or asking.
-Chris "HW" <hw@hotmail.com> wrote in message news:%23QgBAQ5mGHA.192@TK2MSFTNGP03.phx.gbl... > 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 > > > > > > > > > > > > > > > > > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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. "<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote in message news:uxxFWW5mGHA.4212@TK2MSFTNGP04.phx.gbl... > Try a little punctuation - I'm really not sure what you're saying or > asking. > > -Chris > > > > "HW" <hw@hotmail.com> wrote in message > news:%23QgBAQ5mGHA.192@TK2MSFTNGP03.phx.gbl... >> 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 >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
It is getting thrown as inner exception. How does one go about
solving inner exceptions? "HW" <hw@hotmail.com> wrote in message news:%23ez0fa5mGHA.2252@TK2MSFTNGP04.phx.gbl... > 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. > > > "<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote in message > news:uxxFWW5mGHA.4212@TK2MSFTNGP04.phx.gbl... >> Try a little punctuation - I'm really not sure what you're saying or >> asking. >> >> -Chris >> >> >> >> "HW" <hw@hotmail.com> wrote in message >> news:%23QgBAQ5mGHA.192@TK2MSFTNGP03.phx.gbl... >>> 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 >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> >> > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

