gpt4 book ai didi

c# - 程序在调试时崩溃

转载 作者:太空宇宙 更新时间:2023-11-03 16:21:51 33 4
gpt4 key购买 nike

我是 C# 新手,这是我的第一个程序。我正在尝试从 OVH.IE 集成一个 SOAPI(更多信息在这里:www.ovh.ie/products/soapi.xml),但是每当我启动程序并单击登录按钮时程序崩溃(VS2012 的内存使用增加然后崩溃)。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Web.Services;

namespace Server_Manager
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
}

void login(string uid, string pwd, string dc)
{
if (dc == "OVH")
{
managerService soapi = new managerService();
string session = soapi.login(uid, pwd, "ie", false);
if (String.IsNullOrWhiteSpace(session))
{
MessageBox.Show("Not Logged");
}
else
{
MessageBox.Show("Logged In");
}
}

}

private void button1_Click(object sender, EventArgs e)
{
if (String.IsNullOrWhiteSpace(textBox1.Text) || String.IsNullOrWhiteSpace(textBox1.Text))
{
MessageBox.Show("Please Fill all the Details");
}
else
{
string uid, pwd, dc;
uid = textBox1.Text;
pwd = textBox2.Text;
dc = comboBox1.Text;
login(uid,pwd,dc);
}
MessageBox.Show(comboBox1.Text);
}
}
}

最佳答案

这些说明用于在 WinDBG 中对此进行诊断,WinDBG 是一种来自 Microsoft 的基于命令行的调试器,但我被告知它们可以在 Visual Studio 中工作。

  1. 启动应用
  2. 启动 WinDBG 并附加到应用程序
  3. 输入“.loadby sos clr”(假设 >=4.0 框架)
  4. 输入“dumpheap -stat”
  5. 查看结果,对于可疑对象,键入“dumpheap -mt {0}”,其中 {0} 替换为对象 MT 地址
  6. 如果您不知道对象为何存活,请键入“gcroot {0}”并从上方传递一个对象地址

关于c# - 程序在调试时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13666690/

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