Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Replace "can not" to "cannot" in error messages (#12571) fixes #12560
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuarezruiz authored Oct 23, 2020
1 parent 161c3ec commit 51d840a
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions Xamarin.Forms.Core/BindableObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,13 @@ internal void SetValueCore(BindableProperty property, object value, SetValueFlag
throw new ArgumentNullException(nameof(property));
if (checkAccess && property.IsReadOnly)
{
Log.Warning("BindableObject", $"Can not set the BindableProperty \"{property.PropertyName}\" because it is readonly.");
Log.Warning("BindableObject", $"Cannot set the BindableProperty \"{property.PropertyName}\" because it is readonly.");
return;
}

if (!converted && !property.TryConvert(ref value))
{
Log.Warning("SetValue", $"Can not convert {value} to type '{property.ReturnType}'");
Log.Warning("SetValue", $"Cannot convert {value} to type '{property.ReturnType}'");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Core/Binding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Binding(string path, BindingMode mode = BindingMode.Default, IValueConver
if (path == null)
throw new ArgumentNullException(nameof(path));
if (string.IsNullOrWhiteSpace(path))
throw new ArgumentException("path can not be an empty string", nameof(path));
throw new ArgumentException("path cannot be an empty string", nameof(path));

Path = path;
Converter = converter;
Expand Down
12 changes: 6 additions & 6 deletions Xamarin.Forms.Core/BindingExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ internal void Apply(object sourceObject, BindableObject target, BindableProperty
_targetProperty = property;

if (_weakTarget != null && _weakTarget.TryGetTarget(out BindableObject prevTarget) && !ReferenceEquals(prevTarget, target))
throw new InvalidOperationException("Binding instances can not be reused");
throw new InvalidOperationException("Binding instances cannot be reused");

if (_weakSource != null && _weakSource.TryGetTarget(out var previousSource) && !ReferenceEquals(previousSource, sourceObject))
throw new InvalidOperationException("Binding instances can not be reused");
throw new InvalidOperationException("Binding instances cannot be reused");

_weakSource = new WeakReference<object>(sourceObject);
_weakTarget = new WeakReference<BindableObject>(target);
Expand Down Expand Up @@ -152,8 +152,8 @@ void ApplyCore(object sourceObject, BindableObject target, BindableProperty prop

if (!TryConvert(ref value, property, property.ReturnType, true))
{
Log.Warning("Binding", "'{0}' can not be converted to type '{1}'.", value, property.ReturnType);
BindingDiagnostics.SendBindingFailure(Binding, current, target, property, null, "{0} can not be converted to type '{1}'", new[] { value, property.ReturnType });
Log.Warning("Binding", "'{0}' cannot be converted to type '{1}'.", value, property.ReturnType);
BindingDiagnostics.SendBindingFailure(Binding, current, target, property, null, "{0} cannot be converted to type '{1}'", new[] { value, property.ReturnType });
return;
}

Expand All @@ -165,8 +165,8 @@ void ApplyCore(object sourceObject, BindableObject target, BindableProperty prop

if (!TryConvert(ref value, property, part.SetterType, false))
{
Log.Warning("Binding", "'{0}' can not be converted to type '{1}'.", value, part.SetterType);
BindingDiagnostics.SendBindingFailure(Binding, current, target, property, null, "{0} can not be converted to type '{1}'", new[] { value, part.SetterType });
Log.Warning("Binding", "'{0}' cannot be converted to type '{1}'.", value, part.SetterType);
BindingDiagnostics.SendBindingFailure(Binding, current, target, property, null, "{0} cannot be converted to type '{1}'", new[] { value, part.SetterType });
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Core/CompressedLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static void OnIsHeadlessPropertyChanged(BindableObject bindable, object oldValue
if (ve == null)
return;
if (ve.IsPlatformEnabled)
throw new InvalidOperationException("IsHeadless can not be modified when the view is rendered");
throw new InvalidOperationException("IsHeadless cannot be modified when the view is rendered");
}

static readonly BindablePropertyKey HeadlessOffsetPropertyKey =
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Core/ImageSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static ImageSource FromResource(string resource, Assembly sourceAssembly
}
else
{
Internals.Log.Warning("Warning", "Can not find CallingAssembly, pass resolvingType to FromResource to ensure proper resolution");
Internals.Log.Warning("Warning", "Cannot find CallingAssembly, pass resolvingType to FromResource to ensure proper resolution");
return null;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Core/Interactivity/BindingCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public BindingBase Binding
if (_binding == value)
return;
if (IsSealed)
throw new InvalidOperationException("Can not change Binding once the Condition has been applied.");
throw new InvalidOperationException("Cannot change Binding once the Condition has been applied.");
_binding = value;
}
}
Expand All @@ -38,7 +38,7 @@ public object Value
if (_triggerValue == value)
return;
if (IsSealed)
throw new InvalidOperationException("Can not change Value once the Condition has been applied.");
throw new InvalidOperationException("Cannot change Value once the Condition has been applied.");
_triggerValue = value;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Core/Interactivity/Condition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal Action<BindableObject, bool, bool> ConditionChanged
if (_conditionChanged == value)
return;
if (_conditionChanged != null)
throw new InvalidOperationException("The same condition instance can not be reused");
throw new InvalidOperationException("The same condition instance cannot be reused");
_conditionChanged = value;
}
}
Expand All @@ -33,7 +33,7 @@ internal bool IsSealed
if (_isSealed == value)
return;
if (!value)
throw new InvalidOperationException("What is sealed can not be unsealed.");
throw new InvalidOperationException("What is sealed cannot be unsealed.");
_isSealed = value;
OnSealed();
}
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Core/Interactivity/DataTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public BindingBase Binding
if (((BindingCondition)Condition).Binding == value)
return;
if (IsSealed)
throw new InvalidOperationException("Can not change Binding once the Trigger has been applied.");
throw new InvalidOperationException("Cannot change Binding once the Trigger has been applied.");
OnPropertyChanging();
((BindingCondition)Condition).Binding = value;
OnPropertyChanged();
Expand All @@ -41,7 +41,7 @@ public object Value
if (((BindingCondition)Condition).Value == value)
return;
if (IsSealed)
throw new InvalidOperationException("Can not change Value once the Trigger has been applied.");
throw new InvalidOperationException("Cannot change Value once the Trigger has been applied.");
OnPropertyChanging();
((BindingCondition)Condition).Value = value;
OnPropertyChanged();
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Core/Interactivity/EventTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void AttachHandlerTo(BindableObject bindable)
}
catch (Exception)
{
Log.Warning("EventTrigger", "Can not attach EventTrigger to {0}.{1}. Check if the handler exists and if the signature is right.", bindable.GetType(), Event);
Log.Warning("EventTrigger", "Cannot attach EventTrigger to {0}.{1}. Check if the handler exists and if the signature is right.", bindable.GetType(), Event);
}
if (_eventinfo != null && _handlerdelegate != null)
_eventinfo.AddEventHandler(bindable, _handlerdelegate);
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Core/Interactivity/PropertyCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public BindableProperty Property
if (_property == value)
return;
if (IsSealed)
throw new InvalidOperationException("Can not change Property once the Trigger has been applied.");
throw new InvalidOperationException("Cannot change Property once the Trigger has been applied.");
_property = value;

//convert the value
Expand Down Expand Up @@ -57,7 +57,7 @@ public object Value
if (_triggerValue == value)
return;
if (IsSealed)
throw new InvalidOperationException("Can not change Value once the Trigger has been applied.");
throw new InvalidOperationException("Cannot change Value once the Trigger has been applied.");

//convert the value
if (_property != null && s_valueConverter != null)
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Core/Interactivity/Trigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public BindableProperty Property
if (((PropertyCondition)Condition).Property == value)
return;
if (IsSealed)
throw new InvalidOperationException("Can not change Property once the Trigger has been applied.");
throw new InvalidOperationException("Cannot change Property once the Trigger has been applied.");
OnPropertyChanging();
((PropertyCondition)Condition).Property = value;
OnPropertyChanged();
Expand All @@ -41,7 +41,7 @@ public object Value
if (((PropertyCondition)Condition).Value == value)
return;
if (IsSealed)
throw new InvalidOperationException("Can not change Value once the Trigger has been applied.");
throw new InvalidOperationException("Cannot change Value once the Trigger has been applied.");
OnPropertyChanging();
((PropertyCondition)Condition).Value = value;
OnPropertyChanged();
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Core/Interactivity/TriggerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private set
if (_isSealed == value)
return;
if (!value)
throw new InvalidOperationException("What is sealed can not be unsealed.");
throw new InvalidOperationException("What is sealed cannot be unsealed.");
_isSealed = value;
OnSeal();
}
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Core/Layout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ void InternalChildrenOnCollectionChanged(object sender, NotifyCollectionChangedE
continue;

if (item == this)
throw new InvalidOperationException("Can not add self to own child collection.");
throw new InvalidOperationException("Cannot add self to own child collection.");

OnInternalAdded(v);
}
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Core/ListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ static void OnGroupDisplayBindingChanged(BindableObject bindable, BindingBase ol
if (newValue != null && lv.GroupHeaderTemplate != null)
{
lv.GroupHeaderTemplate = null;
Log.Warning("ListView", "GroupHeaderTemplate and GroupDisplayBinding can not be set at the same time, setting GroupHeaderTemplate to null");
Log.Warning("ListView", "GroupHeaderTemplate and GroupDisplayBinding cannot be set at the same time, setting GroupHeaderTemplate to null");
}
}

Expand All @@ -573,7 +573,7 @@ static void OnGroupHeaderTemplateChanged(BindableObject bindable, object oldvalu
if (newValue != null && lv.GroupDisplayBinding != null)
{
lv.GroupDisplayBinding = null;
Log.Warning("ListView", "GroupHeaderTemplate and GroupDisplayBinding can not be set at the same time, setting GroupDisplayBinding to null");
Log.Warning("ListView", "GroupHeaderTemplate and GroupDisplayBinding cannot be set at the same time, setting GroupDisplayBinding to null");
}
}

Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Core/LockableObservableListWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
void ThrowOnLocked()
{
if (IsLocked)
throw new InvalidOperationException("The Items list can not be manipulated if the ItemsSource property is set");
throw new InvalidOperationException("The Items list cannot be manipulated if the ItemsSource property is set");
}

public string this[int index]
Expand Down
8 changes: 4 additions & 4 deletions Xamarin.Forms.Core/MultiBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ internal override void Apply(bool fromTarget)
_applying = true;
if (!BindingExpression.TryConvert(ref value, _targetProperty, _targetProperty.ReturnType, true))
{
Log.Warning("MultiBinding", "'{0}' can not be converted to type '{1}'.", value, _targetProperty.ReturnType);
BindingDiagnostics.SendBindingFailure(this, null, _targetObject, _targetProperty, null, "{0} can not be converted to type '{1}'", new[] { value, _targetProperty.ReturnType });
Log.Warning("MultiBinding", "'{0}' cannot be converted to type '{1}'.", value, _targetProperty.ReturnType);
BindingDiagnostics.SendBindingFailure(this, null, _targetObject, _targetProperty, null, "{0} cannot be converted to type '{1}'", new[] { value, _targetProperty.ReturnType });
return;
}
_targetObject.SetValueCore(_targetProperty, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted);
Expand Down Expand Up @@ -164,8 +164,8 @@ internal override void Apply(object context, BindableObject targetObject, Bindab
_applying = true;
if (!BindingExpression.TryConvert(ref value, _targetProperty, _targetProperty.ReturnType, true))
{
Log.Warning("MultiBinding", "'{0}' can not be converted to type '{1}'.", value, _targetProperty.ReturnType);
BindingDiagnostics.SendBindingFailure(this, context, _targetObject, _targetProperty, null, "{0} can not be converted to type '{1}'", new[] { value, _targetProperty.ReturnType });
Log.Warning("MultiBinding", "'{0}' cannot be converted to type '{1}'.", value, _targetProperty.ReturnType);
BindingDiagnostics.SendBindingFailure(this, context, _targetObject, _targetProperty, null, "{0} cannot be converted to type '{1}'", new[] { value, _targetProperty.ReturnType });
return;
}
_targetObject.SetValueCore(_targetProperty, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted);
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Core/NavigationModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public Page Pop(Page ancestralNav)
if (stack.Contains(ancestralNav))
{
if (stack.Count <= 1)
throw new InvalidNavigationException("Can not pop final item in stack");
throw new InvalidNavigationException("Cannot pop final item in stack");
Page result = stack.Last();
stack.Remove(result);
return result;
Expand Down Expand Up @@ -117,7 +117,7 @@ public void PopToRoot(Page ancestralNav)
if (stack.Contains(ancestralNav))
{
if (stack.Count <= 1)
throw new InvalidNavigationException("Can not pop final item in stack");
throw new InvalidNavigationException("Cannot pop final item in stack");
stack.RemoveRange(1, stack.Count - 1);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Core/ResourceDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Type MergedWith
return;

if (_source != null)
throw new ArgumentException("MergedWith can not be used with Source");
throw new ArgumentException("MergedWith cannot be used with Source");

if (!typeof(ResourceDictionary).GetTypeInfo().IsAssignableFrom(value.GetTypeInfo()))
throw new ArgumentException("MergedWith should inherit from ResourceDictionary");
Expand Down Expand Up @@ -66,7 +66,7 @@ public void SetAndLoadSource(Uri value, string resourcePath, Assembly assembly,
{
_source = value;
if (_mergedWith != null)
throw new ArgumentException("Source can not be used with MergedWith");
throw new ArgumentException("Source cannot be used with MergedWith");

//this will return a type if the RD as an x:Class element, and codebehind
var type = XamlResourceIdAttribute.GetTypeForPath(assembly, resourcePath);
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Core/TemplateBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public TemplateBinding(string path, BindingMode mode = BindingMode.Default, IVal
if (path == null)
throw new ArgumentNullException("path");
if (string.IsNullOrWhiteSpace(path))
throw new ArgumentException("path can not be an empty string", "path");
throw new ArgumentException("path cannot be an empty string", "path");

AllowChaining = true;
Path = path;
Expand Down
12 changes: 6 additions & 6 deletions Xamarin.Forms.Core/TypedBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ internal override void Apply(object context, BindableObject bindObj, BindablePro
#if (!DO_NOT_CHECK_FOR_BINDING_REUSE)
BindableObject prevTarget;
if (_weakTarget.TryGetTarget(out prevTarget) && !ReferenceEquals(prevTarget, bindObj))
throw new InvalidOperationException("Binding instances can not be reused");
throw new InvalidOperationException("Binding instances cannot be reused");

object previousSource;
if (_weakSource.TryGetTarget(out previousSource) && !ReferenceEquals(previousSource, source))
throw new InvalidOperationException("Binding instances can not be reused");
throw new InvalidOperationException("Binding instances cannot be reused");
#endif
_weakSource.SetTarget(source);
_weakTarget.SetTarget(bindObj);
Expand Down Expand Up @@ -229,8 +229,8 @@ internal void ApplyCore(object sourceObject, BindableObject target, BindableProp
}
if (!BindingExpression.TryConvert(ref value, property, property.ReturnType, true))
{
Log.Warning("Binding", "'{0}' can not be converted to type '{1}'.", value, property.ReturnType);
BindingDiagnostics.SendBindingFailure(this, sourceObject, target, property, null, "{0} can not be converted to type '{1}'", new[] { value, property.ReturnType });
Log.Warning("Binding", "'{0}' cannot be converted to type '{1}'.", value, property.ReturnType);
BindingDiagnostics.SendBindingFailure(this, sourceObject, target, property, null, "{0} cannot be converted to type '{1}'", new[] { value, property.ReturnType });
return;
}
target.SetValueCore(property, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted);
Expand All @@ -243,8 +243,8 @@ internal void ApplyCore(object sourceObject, BindableObject target, BindableProp
var value = GetTargetValue(target.GetValue(property), typeof(TProperty));
if (!BindingExpression.TryConvert(ref value, property, typeof(TProperty), false))
{
Log.Warning("Binding", "'{0}' can not be converted to type '{1}'.", value, typeof(TProperty));
BindingDiagnostics.SendBindingFailure(this, sourceObject, target, property, null, "{0} can not be converted to type '{1}'", new[] { value, property.ReturnType });
Log.Warning("Binding", "'{0}' cannot be converted to type '{1}'.", value, typeof(TProperty));
BindingDiagnostics.SendBindingFailure(this, sourceObject, target, property, null, "{0} cannot be converted to type '{1}'", new[] { value, property.ReturnType });
return;
}
_setter((TSource)sourceObject, (TProperty)value);
Expand Down

0 comments on commit 51d840a

Please sign in to comment.