问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/7346932/exception-message-not-being-displayed-correctly-on-client-computers