Address trim warnings

This commit is contained in:
Archi
2023-11-27 15:39:23 +01:00
parent 70d3ca47d7
commit 96239a97f3
4 changed files with 6 additions and 2 deletions

View File

@@ -20,6 +20,7 @@
// limitations under the License. // limitations under the License.
using System; using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization; using System.Globalization;
using System.Net; using System.Net;
using ArchiSteamFarm.IPC.Responses; using ArchiSteamFarm.IPC.Responses;
@@ -39,6 +40,7 @@ public sealed class StructureController : ArchiController {
[HttpGet("{structure:required}")] [HttpGet("{structure:required}")]
[ProducesResponseType<GenericResponse<object>>((int) HttpStatusCode.OK)] [ProducesResponseType<GenericResponse<object>>((int) HttpStatusCode.OK)]
[ProducesResponseType<GenericResponse>((int) HttpStatusCode.BadRequest)] [ProducesResponseType<GenericResponse>((int) HttpStatusCode.BadRequest)]
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2072", Justification = "We don't care about trimmed assemblies, as we need it to work only with the known (used) ones")]
public ActionResult<GenericResponse> StructureGet(string structure) { public ActionResult<GenericResponse> StructureGet(string structure) {
ArgumentException.ThrowIfNullOrEmpty(structure); ArgumentException.ThrowIfNullOrEmpty(structure);

View File

@@ -21,6 +21,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
@@ -44,6 +45,7 @@ public sealed class TypeController : ArchiController {
[HttpGet("{type:required}")] [HttpGet("{type:required}")]
[ProducesResponseType<GenericResponse<TypeResponse>>((int) HttpStatusCode.OK)] [ProducesResponseType<GenericResponse<TypeResponse>>((int) HttpStatusCode.OK)]
[ProducesResponseType<GenericResponse>((int) HttpStatusCode.BadRequest)] [ProducesResponseType<GenericResponse>((int) HttpStatusCode.BadRequest)]
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2075", Justification = "We don't care about trimmed assemblies, as we need it to work only with the known (used) ones")]
public ActionResult<GenericResponse> TypeGet(string type) { public ActionResult<GenericResponse> TypeGet(string type) {
ArgumentException.ThrowIfNullOrEmpty(type); ArgumentException.ThrowIfNullOrEmpty(type);

View File

@@ -37,7 +37,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()}]"))}"; 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")] [UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2057:TypeGetType", 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) { internal static Type? ParseType(string typeText) {
ArgumentException.ThrowIfNullOrEmpty(typeText); ArgumentException.ThrowIfNullOrEmpty(typeText);

View File

@@ -50,7 +50,7 @@
<DebugType>none</DebugType> <DebugType>none</DebugType>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors /> <WarningsAsErrors />
<WarningsNotAsErrors>CA1863,CS8002,IL2026,IL2057,IL2072,IL2075,IL2104,IL3000</WarningsNotAsErrors> <WarningsNotAsErrors>CA1863,CS8002,IL2026,IL2104</WarningsNotAsErrors>
</PropertyGroup> </PropertyGroup>
<!-- Enable public signing if not part of Visual Studio, which is too stupid to understand what public signing is --> <!-- Enable public signing if not part of Visual Studio, which is too stupid to understand what public signing is -->