private void PerformValueConversion(ref object value, out string valueRetrievalFailureMessage) { valueRetrievalFailureMessage = null; if (this.integrationProxy.ProvidesCustomValueConversion) { ValueConvertEventArgs eventArgs = new ValueConvertEventArgs(value, this.validatedProperty.PropertyType, this.integrationProxy, this.validatedProperty.Name); this.integrationProxy.PerformCustomValueConversion(eventArgs); if (eventArgs.ConversionErrorMessage == null) { value = eventArgs.ConvertedValue; } else { value = null; valueRetrievalFailureMessage = eventArgs.ConversionErrorMessage; } } else { if (value != null) { if (value.GetType() == this.validatedProperty.PropertyType) { return; } try { TypeConverter converter = TypeDescriptor.GetConverter(this.validatedProperty.PropertyType); value = converter.ConvertFrom(null, CultureInfo.CurrentCulture, value); } catch (Exception e) { if (e.InnerException is FormatException) { value = null; valueRetrievalFailureMessage = string.Format( CultureInfo.CurrentCulture, Resources.ErrorCannotPerfomDefaultConversion, value, this.validatedProperty.PropertyType.FullName); } else { throw; } } } } }