From 164c4e445585f70c72f0debbb1b36d8ec22f38a0 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 29 Apr 2022 11:13:41 +0100 Subject: [PATCH] Fix exception message formatting in HasCustomAttribute --- X10D/src/ExceptionMessages.Designer.cs | 8 ++++---- X10D/src/ExceptionMessages.resx | 8 ++++---- X10D/src/Reflection/MemberInfoExtensions.cs | 7 +++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/X10D/src/ExceptionMessages.Designer.cs b/X10D/src/ExceptionMessages.Designer.cs index 3f45f18..f880835 100644 --- a/X10D/src/ExceptionMessages.Designer.cs +++ b/X10D/src/ExceptionMessages.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 @@ -160,7 +160,7 @@ namespace X10D { } /// - /// Looks up a localized string similar to {{0}} does not inherit {typeof(Attribute)}. + /// Looks up a localized string similar to {0} does not inherit {1}. /// internal static string TypeDoesNotInheritAttribute { get { @@ -169,7 +169,7 @@ namespace X10D { } /// - /// Looks up a localized string similar to {{0}} is not a class.. + /// Looks up a localized string similar to {0} is not a class.. /// internal static string TypeIsNotClass { get { @@ -178,7 +178,7 @@ namespace X10D { } /// - /// Looks up a localized string similar to {{0}} is not an interface.. + /// Looks up a localized string similar to {0} is not an interface.. /// internal static string TypeIsNotInterface { get { diff --git a/X10D/src/ExceptionMessages.resx b/X10D/src/ExceptionMessages.resx index b887f5a..e9f7bb5 100644 --- a/X10D/src/ExceptionMessages.resx +++ b/X10D/src/ExceptionMessages.resx @@ -1,4 +1,4 @@ - + The buffer is too small to contain the data. - {{0}} is not a class. + {0} is not a class. - {{0}} is not an interface. + {0} is not an interface. - {{0}} does not inherit {typeof(Attribute)} + {0} does not inherit {1} HashAlgorithm does not offer Create method. diff --git a/X10D/src/Reflection/MemberInfoExtensions.cs b/X10D/src/Reflection/MemberInfoExtensions.cs index 78a5328..cbc90f1 100644 --- a/X10D/src/Reflection/MemberInfoExtensions.cs +++ b/X10D/src/Reflection/MemberInfoExtensions.cs @@ -1,4 +1,4 @@ -using System.Globalization; +using System.Globalization; using System.Reflection; namespace X10D.Reflection; @@ -53,9 +53,8 @@ public static class MemberInfoExtensions if (!attribute.Inherits()) { - throw new ArgumentException( - string.Format(CultureInfo.CurrentCulture, ExceptionMessages.TypeDoesNotInheritAttribute, attribute), - nameof(attribute)); + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, ExceptionMessages.TypeDoesNotInheritAttribute, + attribute, typeof(Attribute)), nameof(attribute)); } return member.GetCustomAttribute(attribute) is not null;