c# - Windows 应用程序已停止工作

标签 c# crash windows

我在客户端计算机上安装了 C# Windows 应用程序。它运行良好,突然应用程序崩溃了,当我检查异常时,我得到了以下详细信息:

Description: Stopped working

<ProblemSignatures>
<EventType>CLR20r3</EventType>
<Parameter0>myapp.exe</parameter0>
<Parameter1>2.0.13</parameter0>
<Parameter2>529dadac</parameter0>
<Parameter3>mscorlib</parameter0>
<Parameter4>2.0.0.</parameter0>
<Parameter5>5174ddfb</parameter0>
<Parameter6>c43</parameter0>
<Parameter7>59</parameter0>
<Parameter8>System.FormatException</parameter0>

请提出宝贵建议。

最佳答案

您得到的异常是:- System.FormatException .
这是关于它的简要描述:-

FormatException is thrown when the format of an argument in a method invocation does not match the format of the corresponding formal parameter type. For example, if a method specifies a String parameter consisting of two digits with an embedded period, passing a corresponding string argument containing only two digits to that method would cause FormatException to be thrown. FormatException uses the HRESULT COR_E_FORMAT, which has the value 0x80131537.

如果您有 WinForm 应用程序,请尝试在“Program.cs”文件中执行此操作:-(viusual studio 生成的文件的默认名称)

  try
  {
      Application.Run(new Form()) ; 
  }
  catch(Exception ex)
  {
     Log(ex) ; 
  }

  void Log(Exception ex)
  {
      string stackTrace = ex.StackTrace ; 
      File.WriteAllText(youFilePathHere, stackTrace) ; // path of file where stack trace will be stored.
  }

通过分析堆栈跟踪,您可以轻松了解应用程序中遇到的“运行时异常”。(确切的行号、方法名称等)。
希望对您有帮助!

关于c# - Windows 应用程序已停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20995151/

相关文章:

c++ - 标准 C++ 中是否有一种可移植的方法来检索主机名?

c# - 在生产环境中通过 TLS/SSL 连接时的服务器证书/域自定义验证

c# - 将 List<object> 添加到 EF

c++ - 绘制从类返回的文本会导致程序无错停止

kubernetes - nginx-ingress-controller-CrashLoopBackOff-proxmox上的kubernetes(kvm)

java - 如何在 NetBeans 8 中为 Java 8 应用程序包设置图标?

c - 当进程从另一个进程启动时,为什么 getopt() 得不到第一个参数?

c# - 在c#中将cp1252字符串编码为utf-8字符串

c# - 从 'System.String' 到 'Sitecore.ContentSearch.ProviderIndexConfiguration' 的强制转换无效

.net - 当单元测试调试停止时,Moles 崩溃