我遵循这个question in c#我在设计器共享sub main中的代码是:
#If DEBUG Then
Dim servicio As New CopyFileWorkManagerService
servicio.OnStart(Nothing)
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite)
#Else
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
ServicesToRun = New System.ServiceProcess.ServiceBase() {New Service1}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
#End If
一切都调试好,直到这一行:AddHandler oTimer.Elapsed,AddressOf Me.oTimer_Elapsed
Private Sub New()
InitializeComponent()
log4net.Config.XmlConfigurator.Configure()
oTimer = New Timer(My.Settings.Intervalo)
Debugger.Break()
AddHandler oTimer.Elapsed, AddressOf Me.oTimer_Elapsed
End Sub
方法Private Sub oTimer_Elapsed(sender As Object,e As ElapsedEventArgs)
不调试!!
我做错了什么?