原因:System.Windows.Forms.dll中发生了'System.ArgumentException'类型的第一次机会异常?

时间:2013-11-23 02:21:08

标签: vb.net immediate-window

我在调试时立即获得了这个: System.Windows.Forms.dll中出现'System.ArgumentException'类型的第一次机会异常

好的所以我创建了一个版本检查器来检查版本是否正确,否则更新。 它不起作用。它认为版本是相同的,不会更新。  它工作得很早,现在它已经被随机打破了..

 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

0 个答案:

没有答案