我正在维护一个软件,用户已经在很大程度上报告了这个问题。
它安装在公司LAN上的共享文件夹中,用户通常使用快捷方式在自己的计算机上启动它。这样,它只需要安装一次就可以快速更新。
点击UI后,软件会随机崩溃。似乎时间越长,发生的可能性就越大。我终于可以在Visual Studio中查看我自己的计算机上的崩溃了,它显示了一个错误代码为-2147467259的System.Runtime.InteropServices.SEHException,表示外部组件抛出异常。值得注意的是,如果软件安装在本地计算机上,则不会发生此错误。
我找不到有关如何调查和解决此问题的信息。根据我的理解,这种异常是从非托管代码中抛出的。但这并没有让我走得太远,因为它涵盖了很多例外(再一次,这就是我得到的,我可能是错的)。
一位同事建议它可能与网络有关,比如连接断开。实际上,我发现每次故意停用LAN连接时都会发生同样的错误。
但现在呢?显然,当软件位于远程计算机上并且与该计算机的连接丢失时,该软件无法正常运行。但考虑到我公司选择的部署模式,我该怎么办?此外,我不了解所有客户如此频繁地发生此类问题
我可以尝试哪些解决方案来解决此问题或解决此问题?
修改:
这是我可以收集的一个堆栈跟踪:
MyApp.Form_MessageOkCancel..ctor(String texte,List`1 listLogF,Boolean debugF,Double zoomF)
MyApp.Form1.fermerLapplicationSplit_Click(对象发送者, EventArgs e)System.Windows.Forms.MenuItem.OnClick(EventArgs e)
System.Windows.Forms.MenuItem.MenuItemData.Execute()
System.Windows.Forms.Command.Invoke()
System.Windows.Forms.Command.DispatchID(Int32 id)
System.Windows.Forms.Control.WmCommand(Message& m)
System.Windows.Forms.Control.WndProc(Message& m)
System.Windows.Forms.ButtonBase.WndProc(Message& m)
System.Windows.Forms.Button.WndProc(Message& m)
MyApp.SplitButton.WndProc(消息& m)
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg,IntPtr wparam,IntPtr lparam)
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr的 dwComponentID,Int32 reason,Int32 pvLoopData)
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(的Int32 原因,ApplicationContext上下文)
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(的Int32 原因,ApplicationContext上下文)
System.Windows.Forms.Application.Run(Form mainForm)
MyApp.Program.Main()
System.AppDomain._nExecuteAssembly(RuntimeAssembly程序集,String [] args)System.AppDomain.ExecuteAssembly(String assemblyFile, 证据assemblySecurity,String [] args)
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
System.Threading.ThreadHelper.ThreadStart_Context(Object state)
System.Threading.ExecutionContext.RunInternal(执行上下文 executionContext,ContextCallback回调,对象状态,布尔值 preserveSyncCtx)
System.Threading.ExecutionContext.Run(执行上下文 executionContext,ContextCallback回调,对象状态,布尔值 preserveSyncCtx)
System.Threading.ExecutionContext.Run(执行上下文 executionContext,ContextCallback回调,对象状态)
System.Threading.ThreadHelper.ThreadStart()
Form_MessageOkCancel.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using IM;
_
namespace MyApp
{
public partial class Form_MessageOkCancel : Form
{
public IM.ClassCF.Colors colors { get; set; }
IM.ClassCF classCF = new IM.ClassCF();
List<IM.ClassCF.Log> listLog = new List<IM.ClassCF.Log>();
bool debug;
double zoom = 1;
public Form_MessageOkCancel(string texte, List<IM.ClassCF.Log> listLogF, bool debugF, double zoomF)
{
try
{
listLog = listLogF;
debug = debugF;
zoom = zoomF;
if (debug) classCF.AddLog(listLog, "Form_MessageOkCancel", "Form_MessageOkCancel", "<< Start", "");
InitializeComponent();
Design();
labelText.Text = texte;
this.Height = panel.Top + panel.Height + 94;
if (debug) classCF.AddLog(listLog, "Form_MessageOkCancel", "Form_MessageOkCancel", ">> End", "");
}
catch (Exception ex)
{
if (debug) classCF.AddLog(listLog, "Form_MessageOkCancel", "Form_MessageOkCancel", "<> Error", ex.Message);
}
}
private void btnOk_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void Design()
{
try
{
if (debug) classCF.AddLog(listLog, "Form_MessageOkCancel", "Design", "Start", "");
colors = classCF.UploadColors(listLog, debug);
this.BackColor = colors.fondM;
panel.BackColor = colors.fondC;
btnOk.BackColor = colors.btnFondC;
btnOk.ForeColor = colors.btnEcritureF;
btnCancel.BackColor = colors.btnFondC;
btnCancel.ForeColor = colors.btnEcritureF;
btnOk.Text = IM.WinFormStrings.Ok;
btnCancel.Text = IM.WinFormStrings.Cancel;
if (debug) classCF.AddLog(listLog, "Form_MessageOkCancel", "Design", "End", "");
}
catch (Exception ex)
{
if (debug) classCF.AddLog(listLog, "Form_MessageOkCancel", "Design", "", ex.Message);
}
}
}
}