The code has gone bad. It is in debug mode and jumping around everywhere
Error = "the process or thread has changed since last step"
Here is the code... I just create the file "start.csv" to initialize the shell command. This is very unstable for some reason. When I run line by line in debug mode it starts jumping around irrationally. It gives me versions of the above error.
Option Strict On
Option Explicit On
Imports System.IO
Module Module1
Public WithEvents Tmr As New Timers.Timer
Sub Main()
Console.WriteLine("Worker is Inactive...")
'WORKER RUN
Tmr.Interval = 4000 'Interval where Tmr_Tick is kicked off
Tmr.Enabled = True
Tmr.Start()
Console.ReadLine() 'this prevents the console from closing
End Sub
Sub Tmr_Tick() Handles Tmr.Elapsed
Dim Filepath_Executable As String
Filepath_Executable = "C:\Users\Administrator\Desktop\Machine\Jobs\CurrentJob\Slave1"
If File.Exists(Filepath_Executable + "\" + "Start.csv") Then 'Status_File
Shell(Filepath_Executable + "\" + "program.exe")
Console.Clear()
Console.WriteLine("Worker Started Application...")
' If File.Exists(Filepath_Executable + "\" + "Start.csv") Then File.Delete(Filepath_Executable + "\" + "Start.csv")
'Dim ioFile As New StreamWriter(Filepath_Executable & "running.csv")
'ioFile.Close()
End If
End Sub
End Module