Picked up a legacy VB.NET project originally written for version 1.1 of the .NET framework. I'm running Vista with .NET 3.5. I have cleared out all the original error and the project will build; it just wont run.
As far as I can tell, it is trying to run 'LoginForm' but putting breakpoints in doesn't work because the error is thrown before the breakpoints are reached, regardless of where in the file they are placed.
Really can't work out what to do! Any help appreciated.
StackTrace:
System.IndexOutOfRangeException was unhandled Message="Index was outside the bounds of the array." Source="FirstLine" StackTrace: at FirstLine.LoginForm.main() at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
EDIT: Terribly sorry, didn't appreciate the code would be of much use because the issue is more that I can't get to it. However, here's the main function:
Shared Sub main() Dim p As Process() = Process.GetProcessesByName("FirstLine") If p.Length = 1 Then 'START COPYMINDER 'Dim expirydate As Date = CDate("01/01/1970") 'Dim expiry As Integer 'Try ' GetCopyMinderExpiryDate(expiry) ' If Not expiry = 0 And Not expiry = 1 Then ' expirydate = expirydate.AddSeconds(expiry) ' Dim diff As Integer = DateDiff(DateInterval.Day, Date.Now, expirydate) ' If diff >= 0 And diff 0 Then ' DisplayError((ret_code)) ' End 'End If 'Dim did As String 'GetCopyMinderDeveloperID(did) 'If did "IT" Then ' MessageBox.Show("Invalid Developer ID " & did & ". Firstline will now shutdown", "Firstline", MessageBoxButtons.OK, MessageBoxIcon.Error) ' End 'End If 'END COPYMINDER Dim lf As New LoginForm If LoginSettings.setting("loginShowErrorOnLine") = "TRUE" Then lf.ShowDialog() Else Try lf.ShowDialog() Catch ex As Exception MsgBox(ex.Message) Config.UnlockByUser(Config.currentUser.username) Config.currentUser.UserLoggedOff() End Try End If Else Dim prc As Process = p(0) SwitchToThisWindow(prc.MainWindowHandle, True) End If End Sub
Thanks for your responses so far. It's encouraging to see such a helpful community!
See Question&Answers more detail:os