You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/OpenApi/sample/Controllers/TestController.cs
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
usingSystem.ComponentModel.DataAnnotations;
2
+
usingSystem.Diagnostics.CodeAnalysis;
2
3
usingMicrosoft.AspNetCore.Mvc;
3
4
4
5
[ApiController]
@@ -26,6 +27,7 @@ public class RouteParamsContainer
26
27
27
28
[FromRoute]
28
29
[MinLength(5)]
30
+
[UnconditionalSuppressMessage("Trimming","IL2026:RequiresUnreferencedCode",Justification="MinLengthAttribute works without reflection on string properties.")]
// Disable warnings because RDG does not support complex form binding yet.
50
+
#pragma warning disable IL2026// Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code
51
+
#pragma warning disable IL3050// Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.
52
+
#pragma warning disable RDG003// Unable to resolve parameter
#pragma warning restore RDG003// Unable to resolve parameter
56
+
#pragma warning restore IL3050// Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.
57
+
#pragma warning restore IL2026// Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code
privateconststringTrimWarningMessage="Calls Microsoft.AspNetCore.OpenApi.OpenApiGenerator.GetOpenApiOperation(MethodInfo, EndpointMetadataCollection, RoutePattern) which uses dynamic analysis. Use IServiceCollection.AddOpenApi() to generate OpenAPI metadata at startup for all endpoints,";
22
+
20
23
/// <summary>
21
24
/// Adds an OpenAPI annotation to <see cref="Endpoint.Metadata" /> associated
0 commit comments