0

我有一个非常奇怪的问题。我刚刚在 c# 中使用 Visual Studio 2010 和 .net 4 完成了独立应用程序的开发。

我将安装项目添加到解决方案中,成功构建和编译了所有内容。

我在调试模式下运行它,后来我在我的 xp 机器上安装了我的应用程序,一切都很顺利,效果很好!

现在我把安装包安装在运行 server 2003 r2 的生产机器上,但是当我尝试运行它时,它启动了,我可以看到 gui 几秒钟然后它就崩溃了。

我使用 log4net 在我的代码中添加了许多日志,但找不到为什么在 xp 下它可以完美运行而在 server 2003 r2 下相同的安装不会持续的原因。

然后我认为如果应用程序崩溃,它可能会在系统日志事件查看器下写入,确实如此。每次运行我都会遇到 2 个错误,但我无法真正理解它们的含义。

错误附在下面。任何形式的帮助将不胜感激!

一切顺利!

==================================================== ===============================

第一个错误:

   Event Type:  Error
Event Source:   .NET Runtime 4.0 Error Reporting
Event Category: None
Event ID:   5000
Date:       8/9/2012
Time:       11:03:26 AM
User:       N/A
Computer:   W2003_ORACLE01
Description:
EventType clr20r3, P1 gpsdispatcherserver.exe, P2 1.0.0.0, P3 502220c3, P4 mscorlib, P5 4.0.0.0, P6 4ba1da6f, P7 210, P8 18, P9 system.argumentoutofrange, P10 NIL.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 63 00 6c 00 72 00 32 00   c.l.r.2.
0008: 30 00 72 00 33 00 2c 00   0.r.3.,.
0010: 20 00 67 00 70 00 73 00    .g.p.s.
0018: 64 00 69 00 73 00 70 00   d.i.s.p.
0020: 61 00 74 00 63 00 68 00   a.t.c.h.
0028: 65 00 72 00 73 00 65 00   e.r.s.e.
0030: 72 00 76 00 65 00 72 00   r.v.e.r.
0038: 2e 00 65 00 78 00 65 00   ..e.x.e.
0040: 2c 00 20 00 31 00 2e 00   ,. .1...
0048: 30 00 2e 00 30 00 2e 00   0...0...
0050: 30 00 2c 00 20 00 35 00   0.,. .5.
0058: 30 00 32 00 32 00 32 00   0.2.2.2.
0060: 30 00 63 00 33 00 2c 00   0.c.3.,.
0068: 20 00 6d 00 73 00 63 00    .m.s.c.
0070: 6f 00 72 00 6c 00 69 00   o.r.l.i.
0078: 62 00 2c 00 20 00 34 00   b.,. .4.
0080: 2e 00 30 00 2e 00 30 00   ..0...0.
0088: 2e 00 30 00 2c 00 20 00   ..0.,. .
0090: 34 00 62 00 61 00 31 00   4.b.a.1.
0098: 64 00 61 00 36 00 66 00   d.a.6.f.
00a0: 2c 00 20 00 32 00 31 00   ,. .2.1.
00a8: 30 00 2c 00 20 00 31 00   0.,. .1.
00b0: 38 00 2c 00 20 00 73 00   8.,. .s.
00b8: 79 00 73 00 74 00 65 00   y.s.t.e.
00c0: 6d 00 2e 00 61 00 72 00   m...a.r.
00c8: 67 00 75 00 6d 00 65 00   g.u.m.e.
00d0: 6e 00 74 00 6f 00 75 00   n.t.o.u.
00d8: 74 00 6f 00 66 00 72 00   t.o.f.r.
00e0: 61 00 6e 00 67 00 65 00   a.n.g.e.
00e8: 20 00 4e 00 49 00 4c 00    .N.I.L.
00f0: 0d 00 0a 00               ....   

==================================================== ===============================

第二个错误:

Event Type: Error
Event Source:   .NET Runtime
Event Category: None
Event ID:   1026
Date:       8/9/2012
Time:       11:03:37 AM
User:       N/A
Computer:   W2003_ORACLE01
Description:
Application: GPSDispatcherServer.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentOutOfRangeException
Stack:
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_Item(Int32)
   at GPSDispatcherServer.GPSDispatcherServerManager.createGpsDispInstance()
   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()


For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

==================================================== ===============================

4

2 回答 2

1

你有一个堆栈跟踪,该死的!这比在本机代码中调试崩溃的任何人都梦寐以求。用它。崩溃点的代码在做什么?

看起来您的程序在方法中访问索引超出范围的某些对象 [1]GPSDispatcherServer.GPSDispatcherServerManager.createGpsDispInstance()的列表 ( )。System.Collections.Generic.List检查您some_list[index]在此方法中的所有方法以及从中调用的方法。

我的猜测是某些对象的创建失败并且您的代码忽略了错误。然后您的代码假定该对象已创建并添加到列表中。

失败可能有多种原因:服务器上缺少某些组件、缺少权限、缺少资源、无效路径...

[1] 无法判断列表中的哪个类只有 Release 构建而没有符号。System.__Canon 是编译器生成泛型代码时泛型参数的标准占位符类。

于 2012-08-09T14:37:19.930 回答
0

首先,确保使用调试符号构建应用程序(在项目构建设置中)。

然后在生产服务器上使用DebugDiag来捕获故障转储。还有其他捕获故障转储的方法,但我发现这是最简单的方法之一,而且安装量很小。

可以使用 DebugDiag 或WinDbg离线分析故障转储。最简单的方法是将故障转储文件从服务器上的 DebugDiag Logs 目录复制到构建应用程序的 bin\Release 文件夹中。如果使用 WinDbg,您应该加载与安装在服务器上的 .Net 框架匹配的sos.dll扩展名(例如,在 C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319 中)。因此,也将 sos.dll 复制到您的构建机器,然后使用将其加载到 WinDbg 中

.load <full path to sos.dll>

然后在 WinDbg 中打开故障转储文件。WinDbg 应该能够自动找到应用程序符号 (pdb),因为它们应该与故障转储位于同一目录中(例如 bin\Release),并且 WinDbg 应该会自动从 pdb 中找到源代码。因此,当您打开故障转储时,它应该将您带到导致它的代码行。如果没有,请尝试按 F5。

于 2012-08-09T14:19:42.977 回答