Browse Source
Fixed argument exception constructor calls.
Use nameof where possible.
Fixed wrong check in RelativeSource.AncestorLevel.
pull/2337/head
José Pedro
7 years ago
No known key found for this signature in database
GPG Key ID: B8247B9301707B83
7 changed files with
9 additions and
9 deletions
samples/BindingDemo/ViewModels/ExceptionErrorViewModel.cs
src/Avalonia.Base/Data/Core/Plugins/MethodAccessorPlugin.cs
src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs
src/Avalonia.Remote.Protocol/MetsysBson.cs
src/Avalonia.Visuals/Visual.cs
src/Gtk/Avalonia.Gtk3/ImageSurfaceFramebuffer.cs
src/Markup/Avalonia.Markup/Data/RelativeSource.cs
@ -21,7 +21,7 @@ namespace BindingDemo.ViewModels
}
else
{
throw new ArgumentOutOfRangeException ( "Value must be less than 10." ) ;
throw new ArgumentOutOfRangeException ( nameof ( value ) , "Value must be less than 10." ) ;
}
}
}
@ -21,7 +21,7 @@ namespace Avalonia.Data.Core.Plugins
{
if ( method . GetParameters ( ) . Length + ( method . ReturnType = = typeof ( void ) ? 0 : 1 ) > 8 )
{
var exception = new ArgumentException ( "Cannot create a binding accessor for a method with more than 8 parameters or more than 7 parameters if it has a non-void return type." , nameof ( method ) ) ;
var exception = new ArgumentException ( "Cannot create a binding accessor for a method with more than 8 parameters or more than 7 parameters if it has a non-void return type." , nameof ( methodName ) ) ;
return new PropertyError ( new BindingNotification ( exception , BindingErrorType . Error ) ) ;
}
@ -965,11 +965,11 @@ namespace Avalonia.Controls
{
if ( value < Minimum )
{
throw new ArgumentOutOfRangeException ( nameof ( Minimum ) , string . Format ( "Value must be greater than Minimum value of {0}" , Minimum ) ) ;
throw new ArgumentOutOfRangeException ( nameof ( value ) , string . Format ( "Value must be greater than Minimum value of {0}" , Minimum ) ) ;
}
else if ( value > Maximum )
{
throw new ArgumentOutOfRangeException ( nameof ( Maximum ) , string . Format ( "Value must be less than Maximum value of {0}" , Maximum ) ) ;
throw new ArgumentOutOfRangeException ( nameof ( value ) , string . Format ( "Value must be less than Maximum value of {0}" , Maximum ) ) ;
}
}
@ -749,7 +749,7 @@ namespace Metsys.Bson
if ( memberExpression . Expression . NodeType ! = ExpressionType . Parameter & & memberExpression . Expression . NodeType ! = ExpressionType . Convert )
{
throw new ArgumentException ( string . Format ( "Expression '{0}' must resolve to top-level member." , lambdaExpression ) , "lambdaExpression" ) ;
throw new ArgumentException ( string . Format ( "Expression '{0}' must resolve to top-level member." , lambdaExpression ) , nameof ( lambdaExpression ) ) ;
}
return memberExpression . Member . Name ;
default :
@ -551,7 +551,7 @@ namespace Avalonia
{
if ( c = = null )
{
throw new ArgumentNullException ( "Cannot add null to VisualChildren." ) ;
throw new ArgumentNullException ( nameof ( c ) , "Cannot add null to VisualChildren." ) ;
}
if ( c . VisualParent ! = null )
@ -84,7 +84,7 @@ namespace Avalonia.Gtk3
public RenderOp ( GtkWidget widget , ManagedCairoSurface surface , double factor , int width , int height )
{
_ widget = widget ;
_ surface = surface ? ? throw new ArgumentNullException ( ) ;
_ surface = surface ? ? throw new ArgumentNullException ( nameof ( surface ) ) ;
_f actor = factor ;
_ width = width ;
_ height = height ;
@ -85,9 +85,9 @@ namespace Avalonia.Data
get { return _ ancestorLevel ; }
set
{
if ( _ ancestorLevel < = 0 )
if ( value < = 0 )
{
throw new ArgumentOutOfRangeException ( "AncestorLevel may not be set to less than 1." ) ;
throw new ArgumentOutOfRangeException ( nameof ( value ) , "AncestorLevel may not be set to less than 1." ) ;
}
_ ancestorLevel = value ;