try
{
var a = Convert.ToInt32("AA");
}
catch (Exception ex)
{
StackTrace st = new StackTrace(ex, true);
string strErrorLine = st.GetFrame(st.FrameCount - 1).GetFileLineNumber().ToString();
string currentName = st.GetFrame(st.FrameCount - 1).GetMethod().Name;
string callName = new System.Diagnostics.StackTrace(ex, true).GetFrame(0).GetFileName();
string strBodyMsg = "";
strBodyMsg += "訊息提示: " + ex.Message.ToString() + Environment.NewLine;
strBodyMsg += "錯誤行數: " + strErrorLine + Environment.NewLine;
strBodyMsg += "錯誤檔案: " + callName + Environment.NewLine;
strBodyMsg += "呼叫方法: " + currentName + Environment.NewLine;
MessageBox.Show(strBodyMsg);
}我要如何在deployment 情況下,return 真實錯誤欄位
{
var a = Convert.ToInt32("AA");
}
catch (Exception ex)
{
StackTrace st = new StackTrace(ex, true);
string strErrorLine = st.GetFrame(st.FrameCount - 1).GetFileLineNumber().ToString();
string currentName = st.GetFrame(st.FrameCount - 1).GetMethod().Name;
string callName = new System.Diagnostics.StackTrace(ex, true).GetFrame(0).GetFileName();
string strBodyMsg = "";
strBodyMsg += "訊息提示: " + ex.Message.ToString() + Environment.NewLine;
strBodyMsg += "錯誤行數: " + strErrorLine + Environment.NewLine;
strBodyMsg += "錯誤檔案: " + callName + Environment.NewLine;
strBodyMsg += "呼叫方法: " + currentName + Environment.NewLine;
MessageBox.Show(strBodyMsg);
}我要如何在deployment 情況下,return 真實錯誤欄位
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货