我目前正在處理的項目是一個窗體設計器(Silverlight應用程序),其中用戶可以將控件從工具箱拖動到工作畫布上,然後在屬性中提供其屬性窗格(如Visual Studio和Expression Blend)異常消息未在客戶端計算機上正確顯示
我們在我們的測試服務器的IIS中部署了我們的應用程序,供QC部門測試它。有一個錯誤,在不適用的字段(MinHeight和MinWidth)中輸入「Auto」時沒有正確處理。我們所做的就是去與分配這些無效值,只是捕捉到異常並顯示與異常消息一個消息框:
private void SetControlMinWidth(Control control, TextBox setterTextBox, bool isAdvancedControl = false)
{
try
{
double minWidth = !string.IsNullOrEmpty(setterTextBox.Text) ?
(
setterTextBox.Text.Trim().ToUpper() == "AUTO" ? double.NaN : Convert.ToDouble(setterTextBox.Text)
) : control.MinWidth;
control.MinWidth = minWidth;
}
catch (Exception ex)
{
CustomMessageBox.Show(ex.Message.ToString());
}
}
異常正在傳遞是其默認的消息一個ArgumentException「值不落在預期範圍內「。部署後,開發人員進行了一些測試,異常處理按預期工作。出人意料的是,該QC測試所看到的消息不是ArgumentException的默認的消息,但
[Arg_ArgumentException]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60351.0&File=mscorlib.dll&Key=Arg_ArgumentException
有沒有人經歷過這樣的情況,其中,在QC測試的計算機不在開發計算機顯示正確的異常信息?請記住,開發人員正在測試已部署的應用程序,而不是從Visual Studio運行。
,花花公子:
本文不解釋!非常感謝。看起來好像我們最好傳遞一個用戶友好的錯誤消息,而不是依賴於異常消息。 – yokibitz