ASP.NET Core SpaProxy is not working in newer LINQPad 6 version
Following code:
// Install nuget package: Microsoft.AspNetCore.SpaServices.Extensions WebHost .CreateDefaultBuilder() .Configure(app => app.UseSpa(x => x.UseProxyToSpaDevelopmentServer("https://www.baidu.com"))) .UseUrls("https://+:55555") .Build() .RunAsync(QueryCancelToken)
Cannot be running in current LINQPad 6
, I'm pretty sure it can be running before, the error message is:
Application startup exception: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.AspNetCore.Builder.SpaApplicationBuilderExtensions.UseSpa(IApplicationBuilder app, Action`1 configuration) at UserQuery.<>c.<Main>b__4_0(IApplicationBuilder app) in C:\Users\sdfly\AppData\Local\Temp\LINQPad6\_zmnivmoh\fpgcpy\LINQPadQuery:line 3 at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass0_0.<Configure>b__0(WebHostBuilderContext _, IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass2_1.<Configure>b__2(IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.DelegateStartup.Configure(IApplicationBuilder app) at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication() crit: Microsoft.AspNetCore.Hosting.WebHost[6] Application startup exception System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.AspNetCore.Builder.SpaApplicationBuilderExtensions.UseSpa(IApplicationBuilder app, Action`1 configuration) at UserQuery.<>c.<Main>b__4_0(IApplicationBuilder app) in C:\Users\sdfly\AppData\Local\Temp\LINQPad6\_zmnivmoh\fpgcpy\LINQPadQuery:line 3 at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass0_0.<Configure>b__0(WebHostBuilderContext _, IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass2_1.<Configure>b__2(IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.DelegateStartup.Configure(IApplicationBuilder app) at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication() 6NullReferenceException4 Object reference not set to an instance of an object.
Comments
Interesting - it works with 3.1.2 but not 3.1.3. It appears that the dependency injection library is failing to resolve
IOptions<SpaOptions>
, so the following fails:I've identified an obscure assembly resolution issue which I believe is causing this. Try the latest beta (6.9.1) and let me know how you get along.
Work great in latest 6.9.1, thanks.