Hello, L'exception est réellement inattendu dans ce cadre la, surtout qu'elle ne surgit qu'une 1 Fois sur / 3
Voila le code ou sa planque (code remanier un peu pour tester W_w)
quand a ce fameux patchlist, il provient d'un téléchargement aussi robuste que possible :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 try { StreamReader readP1 = new StreamReader(Application.StartupPath + "\\pdata\\patchlist.php"); readP1.Close(); } catch { Thread.Sleep(400); StreamReader readP2 = new StreamReader(Application.StartupPath + @"\pdata\patchlist.php"); readP2.Close(); }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22public void Download(Uri url, string path, string status) { Program.myform.statusLabel.Invoke((ThreadStart)delegate() { Program.myform.statusLabel.Text = "Status :" + status; }); if (!Directory.Exists(Path.GetDirectoryName(path))) Directory.CreateDirectory(Path.GetDirectoryName(path)); if (File.Exists(path)) File.Delete(path); WebClient client = new WebClient(); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); client.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(client_DownloadFileCompleted); DataTreatement.wait = true; using (WebClient wcDl = new WebClient()) { try { wcDl.DownloadFileAsync(url, path); } catch { System.Windows.Forms.MessageBox.Show("EXCEPTION TEST"); } } }








Répondre avec citation

), il sert à quoi le WebClient client ? Il n'est pas utilisé ... et tu instancies un nouveau WebClient (wcDl) pour downloader la page de façon asynchrone pour lequel tu n'es pas abonné aux événements ... je ne comprends pas trop la logique dans tout ça. Même remarque pour ton try ... catch qui est loin d'être "robuste" ... comme la plupart du code que tu as posté ici depuis le début (désolé).


Partager