M
Mr Newbie
Im going insane trying to sort this out. The following code has been tested
and works fine ( without the Diagnostic.Debugger.Break() line of course, on
windows forms application ). In a windows service ( Assembly has full
trust ) and with the Debugger line in, if Im lucky and it doesent lock up, I
get to line *************** HERE ********** and it Gives me the message that
the Service has shutdown, because it does this when there is no work to do.
How the hell are you supposed to debug this crap ????
-----------------------------
Protected Overrides Sub OnStart(ByVal args() As String)
'If file exists then read it into the TimesDS Dataset
'Otherwise, simply create and store it.
'We are using strings to represent times.
Diagnostics.Debugger.Break()
Dim fi As New System.IO.FileInfo("Times.xml")
If Not fi.Exists Then
Dim nr As Times.TimesRow = TimesDS.Times.NewRow
nr.TimeOff = "23:03:00"
nr.TimeOn = "09:00:00"
TimesDS.Times.Rows.Add(nr)
TimesDS.WriteXml("Times.xml")
Else
TimesDS.ReadXml("Times.xml")
End If
TimeOn = TimesDS.Times.Rows(0)("TimeOn") '*************** HERE
**********
TimeOff = TimesDS.Times.Rows(0)("TimeOff")
hrOn = Convert.ToInt32(TimeOn.Split(":")(0))
minOn = Convert.ToInt32(TimeOn.Split(":")(1))
secOn = Convert.ToInt32(TimeOn.Split(":")(2))
hrOff = Convert.ToInt32(TimeOff.Split(":")(0))
minOff = Convert.ToInt32(TimeOff.Split(":")(1))
secOff = Convert.ToInt32(TimeOff.Split(":")(2))
Timer1.Interval = 2000
Timer1.Enabled = True
End Sub
and works fine ( without the Diagnostic.Debugger.Break() line of course, on
windows forms application ). In a windows service ( Assembly has full
trust ) and with the Debugger line in, if Im lucky and it doesent lock up, I
get to line *************** HERE ********** and it Gives me the message that
the Service has shutdown, because it does this when there is no work to do.
How the hell are you supposed to debug this crap ????
-----------------------------
Protected Overrides Sub OnStart(ByVal args() As String)
'If file exists then read it into the TimesDS Dataset
'Otherwise, simply create and store it.
'We are using strings to represent times.
Diagnostics.Debugger.Break()
Dim fi As New System.IO.FileInfo("Times.xml")
If Not fi.Exists Then
Dim nr As Times.TimesRow = TimesDS.Times.NewRow
nr.TimeOff = "23:03:00"
nr.TimeOn = "09:00:00"
TimesDS.Times.Rows.Add(nr)
TimesDS.WriteXml("Times.xml")
Else
TimesDS.ReadXml("Times.xml")
End If
TimeOn = TimesDS.Times.Rows(0)("TimeOn") '*************** HERE
**********
TimeOff = TimesDS.Times.Rows(0)("TimeOff")
hrOn = Convert.ToInt32(TimeOn.Split(":")(0))
minOn = Convert.ToInt32(TimeOn.Split(":")(1))
secOn = Convert.ToInt32(TimeOn.Split(":")(2))
hrOff = Convert.ToInt32(TimeOff.Split(":")(0))
minOff = Convert.ToInt32(TimeOff.Split(":")(1))
secOff = Convert.ToInt32(TimeOff.Split(":")(2))
Timer1.Interval = 2000
Timer1.Enabled = True
End Sub