客户端计算机上未正确显示异常消息
当前正在开发的项目是一个表单设计器(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 运行。
The project I'm currently working on is a form designer (Silverlight Application) wherein the user can drag a control from the toolbox to the work canvas and then supply its properties in the property pane (like Visual Studio and Expression Blend)
We deployed our app in the IIS of our test server for the QC department to test it. There is a certain bug wherein typing in "Auto" in fields where it is not applicable (MinHeight and MinWidth) is not being handled properly. What we did is go on with assigning those invalid values and just capture the exception and display a message box with the exception message:
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());
}
}
The exception that is being passed is an ArgumentException with its default message "Value does not fall within the expected range." After deployment, the developers did some testing and the exception handling is working as expected. Surprisingly, the message that the QC testers are seeing is not the default message of ArgumentException but
[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
Has anyone experienced this scenario wherein developer computers are displaying the correct exception message while QC tester computers do not? Remember that the developers are testing the deployed app and not running from visual studio.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为调试字符串已从 Silverlight 的最终用户版本中删除。
这篇文章确实解释了这一点:
http://blogs.msdn.com/b/silverlightws/archive/2008/04/06/getting-full-exceptions-in-silverlight-2-beta-1.aspx
I think debugging strings are removed from the end-user version of Silverlight.
This article does explain it:
http://blogs.msdn.com/b/silverlightws/archive/2008/04/06/getting-full-exceptions-in-silverlight-2-beta-1.aspx