2012-12-02 303 views
2

我是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); 
    } 
} 
} 
+0

崩潰時是否收到任何異常消息? – ayls

+0

api是否支持.net框架版本? – urlreader

+0

我認爲你是在登錄功能內部調用登錄。 – sajanyamaha

回答

0

這些指令是在WinDbg中,微軟的基於命令行的調試診斷,但我一直告訴他們可以在Visual Studio中的工作。

  1. 啓動應用
  2. 啓動的WinDBG和附加到該應用程序
  3. 鍵入 「.loadby SOS CLR」(假設> = 4.0框架)
  4. 類型 「dumpheap -stat」
  5. 查看結果,對於可疑對象輸入「dumpheap -mt {0}」,其中{0}被對象MT地址代替
  6. 如果您不知道爲什麼對象處於活動狀態,請鍵入「gcroot {0}」從
  7. 以上傳遞對象地址
+0

我無法找到任何我使用VS2012的WinDBG選項。 –

+0

它是Windows調試工具包的一部分:http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx – taylorjonl