I'm seeing something weird and I must just be overlooking something. I have
a connection and I open it(connection is named 'cn'). I close it in my
execution block but I have it wrapped in a Try/Catch/Finally and in finally
I check if the connectionState <> ConnectionState.Closed - if it's not then
I call .Close. However, even though it successfully closes and the debugger
tells me it's closed in the If Statement, it still runs to Close. This
isn't a big deal in that it doesn't cause any problems but I've verified
that the connection is closed and I'm wondering what's up with that?



Finally

Debug.Assert(cn.State = ConnectionState.Closed)

'The assertion doesn't fail indicating that it's in fact close



If cn.State <> ConnectionState.Closed Then cn.Close()

If I put my cursor here (On cn.State) it indicates closed as well, but it
always calls Close anyway. Any ideas?

End Try




--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups

Re: ConnectionState issue by Miha

Miha
Thu Jul 08 12:22:11 CDT 2004

Hi William,

Why don't you put if statement in more lines and put a debug.writeline
inside:
If cn.State <> ConnectionState.Closed Then
Debug.WriteLine(cn.State)
cn.Close()
End If

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com


"William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
news:%23SJhd5PZEHA.3988@tk2msftngp13.phx.gbl...
> I'm seeing something weird and I must just be overlooking something. I
have
> a connection and I open it(connection is named 'cn'). I close it in my
> execution block but I have it wrapped in a Try/Catch/Finally and in
finally
> I check if the connectionState <> ConnectionState.Closed - if it's not
then
> I call .Close. However, even though it successfully closes and the
debugger
> tells me it's closed in the If Statement, it still runs to Close. This
> isn't a big deal in that it doesn't cause any problems but I've verified
> that the connection is closed and I'm wondering what's up with that?
>
>
>
> Finally
>
> Debug.Assert(cn.State = ConnectionState.Closed)
>
> 'The assertion doesn't fail indicating that it's in fact close
>
>
>
> If cn.State <> ConnectionState.Closed Then cn.Close()
>
> If I put my cursor here (On cn.State) it indicates closed as well, but it
> always calls Close anyway. Any ideas?
>
> End Try
>
>
>
>
> --
>
> W.G. Ryan, eMVP
>
> Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
> Let Microsoft know!
> https://www.windowsembeddedeval.com/community/newsgroups
>
>



Re: ConnectionState issue by William

William
Thu Jul 08 12:41:17 CDT 2004

Thanks Miha! BTW - everything was mailed and should be there any day ;-)

--

W.G. Ryan, eMVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:OBiycARZEHA.3988@tk2msftngp13.phx.gbl...
> Hi William,
>
> Why don't you put if statement in more lines and put a debug.writeline
> inside:
> If cn.State <> ConnectionState.Closed Then
> Debug.WriteLine(cn.State)
> cn.Close()
> End If
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> miha at rthand com
> www.rthand.com
>
>
> "William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
> news:%23SJhd5PZEHA.3988@tk2msftngp13.phx.gbl...
> > I'm seeing something weird and I must just be overlooking something. I
> have
> > a connection and I open it(connection is named 'cn'). I close it in my
> > execution block but I have it wrapped in a Try/Catch/Finally and in
> finally
> > I check if the connectionState <> ConnectionState.Closed - if it's not
> then
> > I call .Close. However, even though it successfully closes and the
> debugger
> > tells me it's closed in the If Statement, it still runs to Close. This
> > isn't a big deal in that it doesn't cause any problems but I've verified
> > that the connection is closed and I'm wondering what's up with that?
> >
> >
> >
> > Finally
> >
> > Debug.Assert(cn.State = ConnectionState.Closed)
> >
> > 'The assertion doesn't fail indicating that it's in fact close
> >
> >
> >
> > If cn.State <> ConnectionState.Closed Then cn.Close()
> >
> > If I put my cursor here (On cn.State) it indicates closed as well, but
it
> > always calls Close anyway. Any ideas?
> >
> > End Try
> >
> >
> >
> >
> > --
> >
> > W.G. Ryan, eMVP
> >
> > Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
> > Let Microsoft know!
> > https://www.windowsembeddedeval.com/community/newsgroups
> >
> >
>
>



Re: ConnectionState issue by Miha

Miha
Thu Jul 08 13:59:00 CDT 2004

Njami :)

"William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
news:OazhRIRZEHA.3596@tk2msftngp13.phx.gbl...
> Thanks Miha! BTW - everything was mailed and should be there any day ;-)