diff --git a/sdk/Sdk.Generators/ExtensionStartupRunnerGenerator.cs b/sdk/Sdk.Generators/ExtensionStartupRunnerGenerator.cs index 763c485ea..163627c79 100644 --- a/sdk/Sdk.Generators/ExtensionStartupRunnerGenerator.cs +++ b/sdk/Sdk.Generators/ExtensionStartupRunnerGenerator.cs @@ -97,6 +97,7 @@ internal string GenerateExtensionStartupRunner(GeneratorExecutionContext context namespace {{namespaceValue}} { [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class WorkerExtensionStartupCodeExecutor : WorkerExtensionStartup { /// diff --git a/sdk/Sdk.Generators/FunctionExecutor/FunctionExecutorGenerator.Emitter.cs b/sdk/Sdk.Generators/FunctionExecutor/FunctionExecutorGenerator.Emitter.cs index 0fcdff7bd..125e8ad6d 100644 --- a/sdk/Sdk.Generators/FunctionExecutor/FunctionExecutorGenerator.Emitter.cs +++ b/sdk/Sdk.Generators/FunctionExecutor/FunctionExecutorGenerator.Emitter.cs @@ -33,6 +33,7 @@ internal static string Emit(GeneratorExecutionContext context, IEnumerable _defaultExecutor;" : string.Empty)}} diff --git a/sdk/Sdk.Generators/FunctionMetadataProviderGenerator/FunctionMetadataProviderGenerator.Emitter.cs b/sdk/Sdk.Generators/FunctionMetadataProviderGenerator/FunctionMetadataProviderGenerator.Emitter.cs index f32202f74..7619ba452 100644 --- a/sdk/Sdk.Generators/FunctionMetadataProviderGenerator/FunctionMetadataProviderGenerator.Emitter.cs +++ b/sdk/Sdk.Generators/FunctionMetadataProviderGenerator/FunctionMetadataProviderGenerator.Emitter.cs @@ -41,6 +41,7 @@ namespace {{FunctionsUtil.GetNamespaceForGeneratedCode(context)}} /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// diff --git a/sdk/release_notes.md b/sdk/release_notes.md index f49464aa3..848febf3b 100644 --- a/sdk/release_notes.md +++ b/sdk/release_notes.md @@ -16,4 +16,5 @@ - Update worker.config generation to accurate worker executable name (#1053) - Fix incorrect value of `ScriptFile` property in function metadata for .Net Framework function apps (#2103) - Generate valid namespace when root namespace contains `-` (#2097) -- Bug fix for scenarios with `$return` output binding and `HttpTrigger` breaking output-binding rules (#2098) \ No newline at end of file +- Bug fix for scenarios with `$return` output binding and `HttpTrigger` breaking output-binding rules (#2098) +- Add `CompilerGeneratedAttribute`` to generated code (#2104) diff --git a/test/Sdk.Generator.Tests/ExtensionStartupRunnerGeneratorTests.cs b/test/Sdk.Generator.Tests/ExtensionStartupRunnerGeneratorTests.cs index 1b6a0cc42..659771fae 100644 --- a/test/Sdk.Generator.Tests/ExtensionStartupRunnerGeneratorTests.cs +++ b/test/Sdk.Generator.Tests/ExtensionStartupRunnerGeneratorTests.cs @@ -40,6 +40,7 @@ public async Task StartupExecutorCodeGetsGenerated() namespace TestProject { [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class WorkerExtensionStartupCodeExecutor : WorkerExtensionStartup { /// @@ -109,6 +110,7 @@ public async Task DiagnosticErrorsAreReportedWhenStartupTypeIsInvalid() namespace MyCompany.MyProject.MyApp { [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class WorkerExtensionStartupCodeExecutor : WorkerExtensionStartup { /// diff --git a/test/Sdk.Generator.Tests/FunctionExecutor/DependentAssemblyTest.cs b/test/Sdk.Generator.Tests/FunctionExecutor/DependentAssemblyTest.cs index e9094d064..ba8c0f6c0 100644 --- a/test/Sdk.Generator.Tests/FunctionExecutor/DependentAssemblyTest.cs +++ b/test/Sdk.Generator.Tests/FunctionExecutor/DependentAssemblyTest.cs @@ -68,6 +68,7 @@ public HttpResponseData Foo([HttpTrigger(AuthorizationLevel.User, "get")] HttpRe namespace TestProject { [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class DirectFunctionExecutor : IFunctionExecutor { private readonly IFunctionActivator _functionActivator; diff --git a/test/Sdk.Generator.Tests/FunctionExecutor/FunctionExecutorGeneratorTests.cs b/test/Sdk.Generator.Tests/FunctionExecutor/FunctionExecutorGeneratorTests.cs index fcda1c27b..9ca958d18 100644 --- a/test/Sdk.Generator.Tests/FunctionExecutor/FunctionExecutorGeneratorTests.cs +++ b/test/Sdk.Generator.Tests/FunctionExecutor/FunctionExecutorGeneratorTests.cs @@ -111,6 +111,7 @@ public void Run2([QueueTrigger(""myqueue-items"")] string message) namespace TestProject {{ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class DirectFunctionExecutor : IFunctionExecutor {{ private readonly IFunctionActivator _functionActivator; @@ -220,6 +221,7 @@ public HttpResponseData Run2([HttpTrigger(AuthorizationLevel.User, ""get"")] Htt namespace MyCompany.MyProject.MyApp {{ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class DirectFunctionExecutor : IFunctionExecutor {{ private readonly IFunctionActivator _functionActivator; @@ -357,6 +359,7 @@ public static Task RunAsync1([EventHubTrigger(""items"", Connection = ""Con"")] namespace TestProject {{ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class DirectFunctionExecutor : IFunctionExecutor {{ private readonly IFunctionActivator _functionActivator; @@ -466,6 +469,7 @@ public HttpResponseData Run1([HttpTrigger(AuthorizationLevel.User, ""get"")] Htt namespace TestProject {{ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class DirectFunctionExecutor : IFunctionExecutor {{ private readonly IFunctionActivator _functionActivator; @@ -551,6 +555,7 @@ public static HttpResponseData FooStatic([HttpTrigger(AuthorizationLevel.User, " namespace TestProject {{ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class DirectFunctionExecutor : IFunctionExecutor {{ private readonly IFunctionActivator _functionActivator; @@ -634,6 +639,7 @@ public static HttpResponseData HELLO([HttpTrigger(AuthorizationLevel.User, ""get namespace TestProject {{ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class DirectFunctionExecutor : IFunctionExecutor {{ private readonly IFunctionActivator _functionActivator; diff --git a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/AutoConfigureStartupTypeTests.cs b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/AutoConfigureStartupTypeTests.cs index 1a7b7906c..40783dae4 100644 --- a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/AutoConfigureStartupTypeTests.cs +++ b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/AutoConfigureStartupTypeTests.cs @@ -78,6 +78,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker.""/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider {{ /// diff --git a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/DependentAssemblyTest.NetFx.cs b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/DependentAssemblyTest.NetFx.cs index 1e38b7813..53239566e 100644 --- a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/DependentAssemblyTest.NetFx.cs +++ b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/DependentAssemblyTest.NetFx.cs @@ -79,6 +79,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// diff --git a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/DependentAssemblyTest.cs b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/DependentAssemblyTest.cs index 049aff319..169d6aa92 100644 --- a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/DependentAssemblyTest.cs +++ b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/DependentAssemblyTest.cs @@ -78,6 +78,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// diff --git a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/EventHubsBindingsTests.cs b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/EventHubsBindingsTests.cs index 8706ce7e5..fd16fdd2b 100644 --- a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/EventHubsBindingsTests.cs +++ b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/EventHubsBindingsTests.cs @@ -98,6 +98,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -231,6 +232,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -331,6 +333,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -478,6 +481,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -635,6 +639,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -755,6 +760,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// diff --git a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/HttpTriggerTests.cs b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/HttpTriggerTests.cs index 67ad7fadd..6d9cd1dac 100644 --- a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/HttpTriggerTests.cs +++ b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/HttpTriggerTests.cs @@ -77,6 +77,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -171,6 +172,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -269,6 +271,7 @@ namespace MyCompany.MyProject.MyApp /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// diff --git a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/IntegratedTriggersAndBindingsTests.cs b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/IntegratedTriggersAndBindingsTests.cs index 9e3f79e0a..f4d482c29 100644 --- a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/IntegratedTriggersAndBindingsTests.cs +++ b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/IntegratedTriggersAndBindingsTests.cs @@ -1,11 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -using System.Collections.Generic; using System.Reflection; using System.Threading.Tasks; using Microsoft.Azure.Functions.Worker.Sdk.Generators; -using Microsoft.CodeAnalysis.Testing; using Xunit; namespace Microsoft.Azure.Functions.SdkGeneratorTests @@ -112,6 +110,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -247,6 +246,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -357,6 +357,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -452,6 +453,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -546,6 +548,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -650,6 +653,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// diff --git a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/NestedTypesTest.cs b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/NestedTypesTest.cs index c89060ade..0593653f6 100644 --- a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/NestedTypesTest.cs +++ b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/NestedTypesTest.cs @@ -82,6 +82,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -177,6 +178,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// diff --git a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/RetryOptionsTests.cs b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/RetryOptionsTests.cs index f130d6def..9b7893dc6 100644 --- a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/RetryOptionsTests.cs +++ b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/RetryOptionsTests.cs @@ -83,6 +83,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -181,6 +182,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// diff --git a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/StorageBindingTests.cs b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/StorageBindingTests.cs index 85b45f88d..09406fffa 100644 --- a/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/StorageBindingTests.cs +++ b/test/Sdk.Generator.Tests/FunctionMetadataProviderGeneratorTests/StorageBindingTests.cs @@ -84,6 +84,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -198,6 +199,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { /// @@ -321,6 +323,7 @@ namespace TestProject /// Custom implementation that returns function metadata definitions for the current worker."/> /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class GeneratedFunctionMetadataProvider : IFunctionMetadataProvider { ///