Thread etrange "ArgumentOutOfRangeException"
Bonjour,
Je lance un thread qui fait appel à une procedure "drawgraph" pour dessiner une courbe.
Code:
1 2
| Public StopThread2 As Boolean
Public thread2 As Threading.Thread |
Code:
1 2 3 4 5
| If thread2 Is Nothing Then
thread2 = New Threading.Thread(AddressOf DrawGraphthread)
thread2.Start()
thread2.Priority = Threading.ThreadPriority.Normal
End If |
Hors dans ce thread si je test une variable "Start.fichier.Mestest(Start.fichier.Mestest.Count - 1).tab_pression.Count" j'ai un ArgumentOutOfRangeException hors l'index "Start.fichier.Mestest.Count - 1" existe bien !
Code:
1 2 3 4 5 6 7
| Public Sub DrawGraphthread()
Do Until StopThread2 = True
If Start.fichier.Mestest(Start.fichier.Mestest.Count - 1).tab_pression.Count > 0 Then
DrawGraph()
End If
Loop
End Sub |
Est ce que le fait d'être dans une tâche limite la lecture de variable ??? Je suis perdu est vraiment bloqué :aie:
voici l'erreur :
Citation:
L'exception System.ArgumentOutOfRangeException n'a pas été gérée
Message=" Parameter name: index"
StackTrace:
in System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) in System.ThrowHelper.ThrowArgumentOutOfRangeException() in System.Collections.Generic.List`1.get_Item(Int32 index) in SewerTest.AirTest.DrawGraphthread()
InnerException:
Pour être le plus clair possible, Tab_pression est dans une structure
Code:
Public tab_pression As New List(Of Double)