|
1 | 1 | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. |
2 | 2 | // See the LICENCE file in the repository root for full licence text. |
| 3 | +using System.Diagnostics.CodeAnalysis; |
3 | 4 |
|
4 | 5 | using System; |
5 | 6 | using System.Collections.Concurrent; |
@@ -42,6 +43,7 @@ public class SettingSourceAttribute : Attribute, IComparable<SettingSourceAttrib |
42 | 43 | /// <remarks> |
43 | 44 | /// Must be a type deriving <see cref="SettingsItem{T}"/> with a public parameterless constructor. |
44 | 45 | /// </remarks> |
| 46 | + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.PublicProperties)] |
45 | 47 | public Type? SettingControlType { get; set; } |
46 | 48 |
|
47 | 49 | public SettingSourceAttribute(Type declaringType, string label, string? description = null) |
@@ -109,6 +111,9 @@ public int CompareTo(SettingSourceAttribute? other) |
109 | 111 |
|
110 | 112 | public static partial class SettingSourceExtensions |
111 | 113 | { |
| 114 | + [UnconditionalSuppressMessage("Trimming", "IL2006", Justification = "The ModSettingsEnumDropdown is correctly generated for the bindable type.")] |
| 115 | + [UnconditionalSuppressMessage("Trimming", "IL2055", Justification = "The ModSettingsEnumDropdown is correctly generated for the bindable type.")] |
| 116 | + [UnconditionalSuppressMessage("Trimming", "IL2067", Justification = "The ModSettingsEnumDropdown is correctly generated for the bindable type.")] |
112 | 117 | public static IEnumerable<Drawable> CreateSettingsControls(this object obj) |
113 | 118 | { |
114 | 119 | foreach (var (attr, property) in obj.GetOrderedSettingsSourceProperties()) |
@@ -260,7 +265,7 @@ public static object GetUnderlyingSettingValue(this object setting) |
260 | 265 | return properties; |
261 | 266 | } |
262 | 267 |
|
263 | | - private static IEnumerable<(SettingSourceAttribute, PropertyInfo)> getSettingsSourceProperties(Type type) |
| 268 | + private static IEnumerable<(SettingSourceAttribute, PropertyInfo)> getSettingsSourceProperties([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type type) |
264 | 269 | { |
265 | 270 | foreach (var property in type.GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance)) |
266 | 271 | { |
|
0 commit comments