Skip to content

Commit fbf4373

Browse files
committed
Deal with warning triggered when then Main method is compiled for the assembly
1 parent fb4f979 commit fbf4373

File tree

1 file changed

+4
-0
lines changed
  • Libraries/src/Amazon.Lambda.RuntimeSupport

1 file changed

+4
-0
lines changed

Libraries/src/Amazon.Lambda.RuntimeSupport/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ namespace Amazon.Lambda.RuntimeSupport
2525
{
2626
class Program
2727
{
28+
// .NET 10 considers adding RequiresUnreferencedCode on the entry point a warning. Our situation is different then the normal use case in that the only time
29+
// the Main exists in the Lambda class library mode which will never be used for Native AOT.
30+
#pragma warning disable IL2123
2831
#if ExecutableOutputType
2932
#if NET8_0_OR_GREATER
3033
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(
@@ -48,6 +51,7 @@ private static async Task Main(string[] args)
4851
await runtimeSupportInitializer.RunLambdaBootstrap();
4952
}
5053
#endif
54+
#pragma warning restore IL2123
5155

5256
#if NET8_0_OR_GREATER
5357
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("This code is only exercised in the class library programming model. Native AOT will not use this code path.")]

0 commit comments

Comments
 (0)