Description
Describe the bug
This isn't really a bug report but more of request for guidance. I maintain the package Amazon.Lambda.AspNetCoreServer which allows running an ASP.NET Core application in a serverless fashion without kestrel.
The library is a netstandard2.0 library making it easy to plugin for ASP.NET Core 2.0, 2.1 or 2.2. I was testing the library on the .NET Core 3.0 preview 4 and it is failing with following exception during startup.
Unhandled Exception: System.MissingMethodException: Method not found: 'Microsoft.AspNetCore.Hosting.IHostingEnvironment Microsoft.AspNetCore.Hosting.WebHostBuilderContext.get_HostingEnvironment()'.
at Amazon.Lambda.AspNetCoreServer.AbstractAspNetCoreFunction`2.<>c.<CreateWebHostBuilder>b__13_1(WebHostBuilderContext hostingContext, ServiceProviderOptions options)
at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass6_0.<UseDefaultServiceProvider>b__0(WebHostBuilderContext context, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at Amazon.Lambda.AspNetCoreServer.AbstractAspNetCoreFunction`2.Start() in C:\codebase\aws-lambda-dotnet\Libraries\src\Amazon.Lambda.AspNetCoreServer\AbstractAspNetCoreFunction.cs:line 210
at LambdaConfigureTest.Program.Main(String[] args) in C:\Users\Norm\Source\Repos\LambdaConfigureTest\LambdaConfigureTest\Program.cs:line 28
The code that is triggering the behavior can be found here.
https://github.com/aws/aws-lambda-dotnet/blob/master/Libraries/src/Amazon.Lambda.AspNetCoreServer/AbstractAspNetCoreFunction.cs#L149-L168
I understand this is happening due to @Tratcher change which changed the return type of the property HostingEnvironment
from IHostingEnvironment
to IWebHostEnvironment
. Which I see he announced here. I'm not sure this change takes libraries like mine that have to target multiple versions of ASP.NET Core into account.
The solution I have thought of so far is add separate build version for netcoreapp3.0 which leads me down the path of having to have a separate version for all future versions of ASP.NET Core which I would rather not do. When making this breaking change was there a discussion on how library authors would be expected to handle the change?