打开时程序崩溃 [英] Program crashes when opening

查看:80
本文介绍了打开时程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Problem signature:
Problem Event Name:CLR20r3
Problem Signature 01:xpro.exe
Problem Signature 02:2.1.1.3
Problem Signature 03:503bf27a
Problem Signature 04:Microsoft.VisualBasic
Problem Signature 05:10.0.0.0
Problem Signature 06:4ba2183b
Problem Signature 07:88
Problem Signature 08:8
Problem Signature 09:System.IO.FileNotFoundException
OS Version:6.1.7600.2.0.0.256.1
Locale ID:3081
Additional Information 1:0a9e
Additional Information 2:0a9e372d3b4ad19135b953a78882e789
Additional Information 3:0a9e
Additional Information 4:0a9e372d3b4ad19135b953a78882e789

>

当我的程序xPro打开时崩溃时,这是错误的详细信息.为什么会崩溃?

在我的计算机上,它可以正常工作.我的客户的计算机出现故障.

该程序与读取表单加载的任何文件有关的唯一事情是读取几个在线文件,以便每个人都可以访问它们.我唯一能想到的就是使用自动更新程序的程序的较新版本.每当程序打开检查更新"表单时,我都具有删除和下载更新程序的功能,这样我可以确保每个人都拥有最新版本的更新程序,以防万一我发现更新程序中的任何错误或进行任何更改.删除旧更新程序的代码在try语句中,因此我看不到如果找不到文件,它将如何导致程序无法加载,并且我知道每个人都有更新程序,因为它已安装在安装程序时包含程序的目录.

我发现System.IO是导致它的错误详细信息的一部分

似乎导致该问题的代码如下:



This are the error details when my program xPro crashes when opening. Why exactly is it crashing?

In my computer it works. It fails in my customer''s computers.

The only thing this program has to do with reading any file on form load is reading s few files that are online so everyone has access to them. The only other thing I can think of is with newer versions of my program with the auto updater. I have it to delete and download the updater everytime the program opens the ''Check For Updates'' form so I can make sure everyone has the latest version of the updater incase I find any bugs in it or make any changes. The code for deleting the old updater is in a try statement so I don''t see how it would cause the program to not load if it can''t find the file and I know everyone has the updater because it is installed into the directory with the program when someone installs it.

I figured the System.IO was the part of the error details that was causing it

The code that seems to cause the issue is the following one:

Try
            Dim instance As WebClient = New WebClient
            Dim address As String = "https://dl.dropbox.com/u/76035776/xPro/xProNews/XboxNews.txt"
            Dim returnValue As String
            returnValue = instance.DownloadString(address)
            KryptonTextBox1.Text = returnValue
        Catch ex As Exception

        End Try
        Try
            Dim instance As WebClient = New WebClient
            Dim address As String = "https://dl.dropbox.com/u/76035776/xPro/xProNews/Battlefield.txt"
            Dim returnValue As String
            returnValue = instance.DownloadString(address)
            KryptonTextBox2.Text = returnValue
        Catch ex As Exception

        End Try
        Try
            Dim instance As WebClient = New WebClient
            Dim address As String = "https://dl.dropbox.com/u/76035776/xPro/xProNews/Minecraft.txt"
            Dim returnValue As String
            returnValue = instance.DownloadString(address)
            KryptonTextBox3.Text = returnValue
        Catch ex As Exception

        End Try
        Try
            Dim instance As WebClient = New WebClient
            Dim address As String = "https://dl.dropbox.com/u/76035776/xPro/xProNews/Other%20Games.txt"
            Dim returnValue As String
            returnValue = instance.DownloadString(address)
            KryptonTextBox4.Text = returnValue
        Catch ex As Exception

        End Try
        If Not File.Exists("C:\xPro\xProUpdater.exe") Then
            Try
                link = "https://dl.dropbox.com/u/76035776/xPro/xProUpdater.exe"
                Dim wr As WebRequest
                wr = WebRequest.Create(link)
                Dim webr As WebResponse = wr.GetResponse
                Dim wc As New WebClient
                wc.DownloadFile(link, "C:\xPro\xProUpdater.exe")
            Catch ex As Exception

            End Try
        Else
            'Do Nothing
        End If
        If My.Settings.AutoUpdate = Nothing Then
            My.Settings.AutoUpdate = "On"
        End If
        If My.Settings.AutoUpdate = "On" Then
            AutoupdateToolStripMenuItem.Text = "Autoupdate: On"
            Try
                KryptonLabel3.Text = Me.ProductVersion
                Dim instance As WebClient = New WebClient
                Dim address As String = "https://dl.dropbox.com/u/76035776/xPro/Version.txt"
                Dim returnValue As String
                returnValue = instance.DownloadString(address)
                KryptonLabel4.Text = returnValue
                If KryptonLabel3.Text >= KryptonLabel4.Text Then

                Else
                    CheckUpdate.Show()
                End If
                Me.Refresh()
            Catch ex As Exception
                MessageBox.Show("Error: Failed to check latest version.")
            End Try
        ElseIf My.Settings.AutoUpdate = "Off" Then
            AutoupdateToolStripMenuItem.Text = "Autoupdate: Off"
        End If
        Me.Show()
        Timer1.Start()
        NotifyIcon1.Text = "xPro " + Me.ProductVersion
        If My.Settings.SearchEngine = Nothing Then
            My.Settings.SearchEngine = "Google"
        End If
        Try
            KryptonManager1.GlobalPaletteMode = My.Settings.Theme
        Catch ex As Exception
            KryptonManager1.GlobalPaletteMode = ComponentFactory.Krypton.Toolkit.PaletteModeManager.Office2007Black
        End Try

        KryptonComboBox1.Text = My.Settings.SearchEngine

推荐答案

问题签名09:System.IO.FileNotFoundException
您尚未共享过多的信息,但是错误的这一行内容确实表明缺少某些需要的文件.似乎程序需要一个不再存在的文件.
Problem Signature 09:System.IO.FileNotFoundException
You have not shared too much of an info, but the error has this line that does states that some file is missing that would be required. Looks like program needs a file which is no more there.


显然,真正的错误是
System.IO.FileNotFoundException

,当文件出现时找不到.查看您的代码,也许您正在从不再存在的文件中加载设置,然后尝试使用

which occurs when a file cannot be found. Look into your code, maybe you''re loading a setting from a file that no longer exists and attempt using

System.IO.File.Exists()

函数检测该文件是否在执行操作之前已存在,当然,如果您只是要创建一个新文件,请检查该文件所在的目录是否已经创建,然后可以再次使用

function to detect if that file exists before performing the action and of course if you''re just going to create a new file, check that the directory where the file would reside has already been created, and again you can use

System.IO.Directory.Exists()

函数.

function.

using System.IO; // Remember to import this namespace.
  if (!Directory.Exists("C:\\My Settings Folder")
            {
                Directory.CreateDirectory("C:\\My Settings Folder");
            }

            if (File.Exists("C:\\My Settings Folder\\My Settings.xml")
            {
                //You can then create a file or load one depending on what you want to do.
            }


问题的另一部分,令我惊讶的是没有人指出,这是因为您的代码中有一堆空的Catch块.这只是将产生的任何异常吞并掉.您永远不会知道您的代码实际上是在试图告诉您什么.

您确实需要在一些将异常记录到某个地方的代码块中放置一些代码,以便您可以在无法重现该问题的此类实例中引用该代码.
Another part of your problem, that I''m surprised nobody pointed out, is that you''ve got a bunch of empty Catch blocks in your code. That just takes any exception generated and swallows it. You''ll never know what your code is actually trying to tell you like that.

You really need to put some code in the blocks that logs the exception somewhere so you can refer to it in instances like this where you can''t reproduce the problem.


这篇关于打开时程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆