Skip to content

Commit 7886a25

Browse files
committed
Exclude the CreateActionModel method from trimming
1 parent e937a99 commit 7886a25

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Mvc/Mvc.Core/src/ApplicationModels/DefaultApplicationModelProvider.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics.CodeAnalysis;
45
using System.Linq;
56
using System.Reflection;
67
using Microsoft.AspNetCore.Http;
@@ -355,6 +356,8 @@ internal PropertyModel CreatePropertyModel(PropertyInfo propertyInfo)
355356
return actionModel;
356357
}
357358

359+
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode",
360+
Justification = "The method utilizes reflection to get information about the return type of an action")]
358361
internal static void AddReturnTypeMetadata(IList<SelectorModel> selectors, MethodInfo methodInfo)
359362
{
360363
// Get metadata from return type
@@ -372,7 +375,7 @@ internal static void AddReturnTypeMetadata(IList<SelectorModel> selectors, Metho
372375
invokeArgs[0] = methodInfo;
373376
invokeArgs[1] = builder;
374377
EndpointMetadataPopulator.PopulateMetadataForEndpointMethod.MakeGenericMethod(returnType).Invoke(null, invokeArgs);
375-
378+
376379
// The metadata is added to the builder's metadata collection.
377380
// We need to populate the selectors with that metadata.
378381
foreach (var metadata in builder.Metadata)

0 commit comments

Comments
 (0)