Fix exception message formatting in HasCustomAttribute

This commit is contained in:
Oliver Booth 2022-04-29 11:13:41 +01:00
parent ba6c400a79
commit 164c4e4455
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
3 changed files with 11 additions and 12 deletions

View File

@ -1,4 +1,4 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
@ -160,7 +160,7 @@ namespace X10D {
}
/// <summary>
/// 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}.
/// </summary>
internal static string TypeDoesNotInheritAttribute {
get {
@ -169,7 +169,7 @@ namespace X10D {
}
/// <summary>
/// Looks up a localized string similar to {{0}} is not a class..
/// Looks up a localized string similar to {0} is not a class..
/// </summary>
internal static string TypeIsNotClass {
get {
@ -178,7 +178,7 @@ namespace X10D {
}
/// <summary>
/// Looks up a localized string similar to {{0}} is not an interface..
/// Looks up a localized string similar to {0} is not an interface..
/// </summary>
internal static string TypeIsNotInterface {
get {

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
@ -27,13 +27,13 @@
<value>The buffer is too small to contain the data.</value>
</data>
<data name="TypeIsNotClass" xml:space="preserve">
<value>{{0}} is not a class.</value>
<value>{0} is not a class.</value>
</data>
<data name="TypeIsNotInterface" xml:space="preserve">
<value>{{0}} is not an interface.</value>
<value>{0} is not an interface.</value>
</data>
<data name="TypeDoesNotInheritAttribute" xml:space="preserve">
<value>{{0}} does not inherit {typeof(Attribute)}</value>
<value>{0} does not inherit {1}</value>
</data>
<data name="HashAlgorithmNoCreateMethod" xml:space="preserve">
<value>HashAlgorithm does not offer Create method.</value>

View File

@ -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<Attribute>())
{
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;