title: thread was created with a ThreadStart delegate that does not accept a parameter
body: <p>I have a question about ThreadStart delegates in vb.net. I am taking over a senior programmer's project, and he is much more experienced then myself so I'm kind of lost on what he was trying to do. I am trying to do some research on Threading but there is a lot out there on this topic and don't want to waste my time with stuff that doesn't pertain to my error here. I will post the whole exception message and hopefully someone can point me in the direction of an article that I could read to learn more about it.</p>
  
  <pre><code>System.InvalidOperationException was unhandled
    Message=The thread was created with a ThreadStart delegate that does not accept a parameter.
    Source=mscorlib
    StackTrace:
         at System.Threading.Thread.Start(Object parameter)
         at LabelLibrary.LabelPrinter.Print(PrintQueue queue) in C:\Documents and Settings\bjorandb\Desktop\LabelPrintingService\LabelTemplates\clsLabelPrinter.vb:line 94
         at LabelLibrary.LabelPrinter.Print() in C:\Documents and Settings\bjorandb\Desktop\LabelPrintingService\LabelTemplates\clsLabelPrinter.vb:line 53
         at PrintApplyApplication.HomeController.PrintThread.Print() in C:\Documents and Settings\bjorandb\Desktop\LabelPrintingService\PrintApplyApplication\Controllers\HomeController.vb:line 85
         at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
         at System.Threading.ExecutionContext.runTryCode(Object userData)
         at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.ThreadHelper.ThreadStart()
    InnerException: 
  </code></pre>
  
  <p>Here is the function that the error is getting thrown in, but I don't know how much help it will be by itself. </p>
  
  <pre><code>Public Function Print(ByVal queue As PrintQueue) As PrintResult
      Dim result As PrintResult = Nothing
      Dim job As PrintSystemJobInfo = Nothing
      Dim thread As Threading.Thread = Nothing
  
      result = New PrintResult
      If queue Is Nothing Then
          result.Status = "Can not find printer " &amp; queue.Name &amp; "."
      ElseIf PrintFilePath Is Nothing Then
          result.Status = "Print File Path Cannot be nothing."
      Else
          Try
              thread = New Threading.Thread(AddressOf AddJob)
              thread.SetApartmentState(Threading.ApartmentState.STA)
              thread.Start(queue) &lt;--- (Exception is being thrown here!!)
              result.Status &amp;= "Print Sent Successfully"
          Catch ex As PrintJobException
              If ex.InnerException.Message = "File contains corrupted data." Then
                  result.Status &amp;= "Could not generate a label with given xps file. Check the xps file format and if it is corrupted."
              End If
              result.Status &amp;= "There was an error printing."
              result.ErrorMessage = ex.Message
          End Try
          If queue.IsOutOfPaper Then
              result.Status &amp;= "The printer is out of Paper."
          End If
          If queue.IsPaperJammed Then
              result.Status &amp;= "The Printer is jammed."
          End If
          If (queue.IsOutOfMemory) Then
              result.Status &amp;= "The Printer is out of memory."
          End If
      End If
      Return result
  End Function
  </code></pre>
  
  <p>And here is the AddJob method</p>
  
  <pre><code>Private Sub AddJob()
      Dim job As PrintSystemJobInfo = Nothing
  
      Try
          job = LocalPrintServer.GetDefaultPrintQueue.AddJob("Text", PrintFilePath, False)
          job.Refresh()
          While Not (job.IsCompleted Or job.IsDeleted)
              job.Refresh()
          End While
      Catch ex As PrintJobException
      End Try
      If System.IO.File.Exists(PrintFilePath) Then
          System.IO.File.Delete(PrintFilePath)
      End If
  End Sub
  </code></pre>