Adagio
Well-known member
- Joined
- Dec 12, 2005
- Messages
- 162
- Programming Experience
- Beginner
I just started working on a new console application (sooner or later it will be changed to a service application, but during test it runs as console application)
The problem is the application quits unexpectedly. No exceptions are thrown or anything
I have added many breakpoints and I'm trying to step through the application. I can get to the breakpoint at the line where I call Teknik.CreateExcelFile(), but I never enter the class. I have a breakpoint at the first line in CreateExcelFile, but the code never reaches that point as the application quits before hitting that breakpoint. I have told the debugger to break at any exceptions handled and unhandled
If I remove the Teknik.CreateExcelFile() line, the application runs like it should, so the problem is here, but how do I get the exception? Something happens for sure, but I can't get any information about what happens
Here is all the code relevant to the problem: (Main is the class that is called on startup)
The problem is the application quits unexpectedly. No exceptions are thrown or anything
I have added many breakpoints and I'm trying to step through the application. I can get to the breakpoint at the line where I call Teknik.CreateExcelFile(), but I never enter the class. I have a breakpoint at the first line in CreateExcelFile, but the code never reaches that point as the application quits before hitting that breakpoint. I have told the debugger to break at any exceptions handled and unhandled
If I remove the Teknik.CreateExcelFile() line, the application runs like it should, so the problem is here, but how do I get the exception? Something happens for sure, but I can't get any information about what happens
Here is all the code relevant to the problem: (Main is the class that is called on startup)
VB.NET:
Public Class Main
Public Shared Sub Main()
ServiceTools.StartService(True)
End Sub
End Class
Module TeknikService
Private isRunning As Boolean = False
Private testFlag As Boolean = False
Public Sub StartService(ByVal test As Boolean)
If isRunning = True Then Exit Sub
testFlag = test
isRunning = True
Dim thd As New System.Threading.Thread(AddressOf ServiceRun)
thd.IsBackground = True
thd.Name = "TeknikService"
thd.Priority = Threading.ThreadPriority.Lowest
thd.Start()
End Sub
Public Sub StopService()
isRunning = False
End Sub
Private Sub ServiceRun()
While isRunning = True
Try
Teknik.CreateExcelFile()
If testFlag = True Then Exit While
System.Threading.Thread.Sleep(1000 * 60 * 5)
Catch ex As Exception
ex = ex
End Try
End While
End Sub
End Module
Public Module ExcelTools
Public Sub CreateExcelFile()
Dim excelEngine As ExcelEngine = New ExcelEngine() ' Some Syncfusion Excel tools
End Sub
End Module