Corrected build warnings related to RequiresUnreferencedCodeAttribute

pull/328/head
David Hall 2022-10-04 09:06:09 -06:00
parent 46aca17c9f
commit 76087b0ab5
3 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,7 @@
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Globalization;
using System.Reflection;
@ -230,6 +231,9 @@ namespace Vanara.PInvoke
public override bool GetCreateInstanceSupported(ITypeDescriptorContext context) => true;
#if NET6_0_OR_GREATER
[RequiresUnreferencedCode(null)]
#endif
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(POINT), attributes);

View File

@ -405,6 +405,9 @@ namespace Vanara.PInvoke
throw new ArgumentException(@"Invalid property value.");
}
#if NET6_0_OR_GREATER
[RequiresUnreferencedCode(null)]
#endif
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
var props = TypeDescriptor.GetProperties(typeof(PRECT), attributes);
@ -478,6 +481,9 @@ namespace Vanara.PInvoke
public override bool GetCreateInstanceSupported(ITypeDescriptorContext context) => true;
#if NET6_0_OR_GREATER
[RequiresUnreferencedCode(null)]
#endif
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
var props = TypeDescriptor.GetProperties(typeof(RECT), attributes);

View File

@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace Vanara.Windows.Forms
@ -10,6 +11,9 @@ namespace Vanara.Windows.Forms
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) =>
destinationType == typeof(string) ? string.Empty : base.ConvertTo(context, culture, value, destinationType);
#if NET6_0_OR_GREATER
[RequiresUnreferencedCode(null)]
#endif
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) =>
TypeDescriptor.GetProperties(value, attributes);
}