Address new trimming warnings

This commit is contained in:
Archi 2021-11-19 22:54:26 +01:00
parent 035d4b9ed8
commit cdd35ad29d
No known key found for this signature in database
GPG key ID: 6B138B4C64555AEA
4 changed files with 10 additions and 0 deletions

View file

@ -24,6 +24,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Compression;
@ -418,6 +419,7 @@ public static class ASF {
}.ToImmutableDictionary();
}
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode", Justification = "We don't care about trimmed assemblies, as we need it to work only with the known (used) ones")]
private static void LoadAssembliesRecursively(Assembly assembly, HashSet<string>? loadedAssembliesNames = null) {
if (assembly == null) {
throw new ArgumentNullException(nameof(assembly));

View file

@ -27,6 +27,7 @@ using IMvcBuilder = Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder;
#endif
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
@ -58,6 +59,7 @@ internal sealed class Startup {
public Startup(IConfiguration configuration) => Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode", Justification = "PathString is a primitive, it's unlikely to be trimmed to the best of our knowledge")]
[UsedImplicitly]
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
if (app == null) {
@ -185,6 +187,7 @@ internal sealed class Startup {
);
}
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode", Justification = "HashSet<string> isn't a primitive, but we widely use the required features everywhere and it's unlikely to be trimmed to the best of our knowledge")]
public void ConfigureServices(IServiceCollection services) {
if (services == null) {
throw new ArgumentNullException(nameof(services));

View file

@ -25,6 +25,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
#endif
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Text;
@ -82,6 +83,7 @@ internal static class WebUtilities {
return type.GenericTypeArguments.Length == 0 ? type.FullName : $"{type.Namespace}.{type.Name}{string.Join("", type.GenericTypeArguments.Select(static innerType => $"[{innerType.GetUnifiedName()}]"))}";
}
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode", Justification = "We don't care about trimmed assemblies, as we need it to work only with the known (used) ones")]
internal static Type? ParseType(string typeText) {
if (string.IsNullOrEmpty(typeText)) {
throw new ArgumentNullException(nameof(typeText));

View file

@ -25,6 +25,7 @@ using System.Collections.Immutable;
using System.Composition;
using System.Composition.Convention;
using System.Composition.Hosting;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
@ -135,6 +136,7 @@ internal static class PluginsCore {
return results.FirstOrDefault();
}
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode", Justification = "We don't care about trimmed assemblies, as we need it to work only with the known (used) ones")]
internal static bool InitPlugins() {
if (ActivePlugins != null) {
return false;
@ -630,6 +632,7 @@ internal static class PluginsCore {
}
}
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode", Justification = "We don't care about trimmed assemblies, as we need it to work only with the known (used) ones")]
private static HashSet<Assembly>? LoadAssembliesFrom(string path) {
if (string.IsNullOrEmpty(path)) {
throw new ArgumentNullException(nameof(path));