本文介绍了异常消息在客户端计算机上未正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发的项目是一个表单设计器(Silverlight Application),其中用户可以将控件从工具箱拖动到工作画布​​中,然后在属性窗格中提供其属性(如Visual Studio和Expression Blend)

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)

我们将我们的应用程序部署在我们的测试服务器的IIS中,供QC部门进行测试。有一个错误,其中在不适用(MinHeight和MinWidth)的字段中键入Auto未正确处理。我们做的是继续分配这些无效值,只是捕获异常并显示一个包含异常消息的消息框:

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());
    }
}

正在传递的异常是一个ArgumentException,它的默认消息值不在预期范围内。部署后,开发人员进行了一些测试,异常处理工作正常。令人惊讶的是,QC测试人员看到的消息不是ArgumentException的默认消息,但是

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

有没有人经历过这种情况,其中开发者计算机正在显示正确的异常消息,而QC测试仪计算机没有?记住,开发人员正在测试部署的应用程序,而不是从visual studio中运行。

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.

推荐答案

我认为调试字符串从最后删除 - 用户版本的Silverlight。

I think debugging strings are removed from the end-user version of Silverlight.

这篇文章解释一下:

这篇关于异常消息在客户端计算机上未正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 10:31