0

I get this in the immediate window while debuging: A first chance exception of type 'System.ArgumentException' occurred in System.Windows.Forms.dll

Okay So I created a version checker to check if the version is correct else update. It is not working. It thinks the version is the same and doesn't update. It was working early and now it's randomly broken..

 Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown



    '*update process
    Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://localhost/update/version.txt")
    Dim response As System.Net.HttpWebResponse = request.GetResponse()
    Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())

    Dim newestversion As String = sr.ReadToEnd()
    Dim currentversion As String = My.Settings.version

    If newestversion.Contains(currentversion) Then
        Label3.Text = "Up to date."
        MsgBox("debug")
        Button1.Enabled = True
    Else
        MsgBox("An new update is available! Please, do NOT close the launcher!", MsgBoxStyle.Information)
        Label3.Text = "Updating game..."
        Label3.Refresh()
        GhostProgressbar1.Value = 10

        'starts(download)
        GhostProgressbar1.Value = +65
        My.Computer.Network.DownloadFile("http://localhost/update/patch.zip", New System.IO.FileInfo(Application.ExecutablePath).DirectoryName + "/patch.zip")
        GhostProgressbar1.Value = +15

        'unzips update
        Dim ZipToUnpack As String = "patch.zip"
        Dim TargetDir As String = New System.IO.FileInfo(Application.ExecutablePath).DirectoryName
        Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)
        Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
            Dim e1 As ZipEntry
            For Each e1 In zip1
                e1.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)
            Next
        End Using
        'delete(zip)
        GhostProgressbar1.Value = +9
        My.Computer.FileSystem.DeleteFile(New System.IO.FileInfo(Application.ExecutablePath).DirectoryName + "/patch.zip")
        GhostProgressbar1.Value = 100

        My.Settings.version = newestversion
        My.Settings.Save()
        MsgBox("The game has been updated successfully!")
    End If
    Label3.Text = "Up to date."
    Label3.Refresh()
    Button1.Enabled = True
End Sub
miguel.renaud
  • 85
  • 1
  • 2
  • 7
  • Where does it throw the exception? – OneFineDay Nov 23 '13 at 02:53
  • apparently in System.Windows.Form.dll – miguel.renaud Nov 23 '13 at 02:57
  • duh, there is a line here that breaks, debug your work - it would probably help you figure this out. – OneFineDay Nov 23 '13 at 02:58
  • What is this `GhostProgressbar1.Value = +65` - that's not how to add value. Either += or just set the value. – OneFineDay Nov 23 '13 at 03:02
  • 1
    If it is just a first-chance exception that does not result in an exception thrown and not caught by your code, then you can ignore it, because first-chance exceptions are the debugger's opportunity to deal with a potential problem and if it does then that is the end of it; otherwise the exception needs to be handled by your code or ultimately by the run-time. – Karl Anderson Nov 23 '13 at 03:04
  • I don't understand what you guys are saying but, I restarted my computer and it's working now... – miguel.renaud Nov 23 '13 at 03:06

0 Answers0