gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 02:38:56 33 4
gpt4 key购买 nike

我在客户端计算机上安装了 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/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com