You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have been following #2168 and have tried all the described solutions there, running locally this works fine, running in PR checks it works fine, but then when running a deploy this breaks.
I'm on .net8 using swashbuckle 6.5.0 (Have tried with original version 6.2.3 and newest 6.8.0 too) it seemed to happen somewhat intermittently in the past but retrying the workflow would eventually get it through however now it's failing continuously.
Only difference between the PR check that works building the project and generating swagger json that I can discern is one is production, other is not but building in production locally works fine.
Expected behavior
Get a swagger openapi json spec
Actual behavior
Exception thrown
Steps to reproduce
No response
Exception(s) (if any)
Unhandled exception. System.InvalidOperationException: A type named 'StartupProduction' or 'Startup' could not be found in assembly 'Speechy.WebApi'.
at Microsoft.AspNetCore.Hosting.StartupLoader.FindStartupType(String startupAssemblyName, String environmentName)
at Microsoft.AspNetCore.Hosting.WebHostBuilder.ScanAssemblyAndRegisterStartup(ServiceCollection services, String startupAssemblyName)
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Hosting.WebHostBuilder.<>c__DisplayClass15_1.<ScanAssemblyAndRegisterStartup>b__1(IServiceProvider _)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.AspNetCore.Hosting.WebHost.EnsureStartup()
at Microsoft.AspNetCore.Hosting.WebHost.EnsureApplicationServices()
at Microsoft.AspNetCore.Hosting.WebHost.Initialize()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at Swashbuckle.AspNetCore.Cli.Program.GetServiceProvider(Assembly startupAssembly) in C:\projects\ahoy\src\Swashbuckle.AspNetCore.Cli\Program.cs:line 145
at Swashbuckle.AspNetCore.Cli.Program.<>c.<Main>b__0_4(IDictionary`2 namedArgs) in C:\projects\ahoy\src\Swashbuckle.AspNetCore.Cli\Program.cs:line 82
at Swashbuckle.AspNetCore.Cli.CommandRunner.Run(IEnumerable`1 args) in C:\projects\ahoy\src\Swashbuckle.AspNetCore.Cli\CommandRunner.cs:line 68
at Swashbuckle.AspNetCore.Cli.CommandRunner.Run(IEnumerable`1 args) in C:\projects\ahoy\src\Swashbuckle.AspNetCore.Cli\CommandRunner.cs:line 59
at Swashbuckle.AspNetCore.Cli.Program.Main(String[] args) in C:\projects\ahoy\src\Swashbuckle.AspNetCore.Cli\Program.cs:line 121
/home/runner/work/Speechy/Speechy/Speechy.WebApi/Speechy.WebApi.csproj(59,9): error MSB[30](https://github.com/dwlgit/Speechy/actions/runs/11048775286/job/30692886141#step:6:31)73: The command "dotnet swagger tofile --output api.json bin/Release/net8.0//Speechy.WebApi.dll v1" exited with code 134.
Swashbuckle.AspNetCore version
6.2.3, 6.4.0, 6.5.0, 6.8.0
.NET Version
.net8.0
Anything else?
Have been looking at all the following #2168
Tried having a blank appsettings.Production.json file but still threw same error along with the different suggested versions
Please provide a minimal reproducible example as a GitHub repository that demonstrates the issue you're experiencing so we can look into this further.
Support for Minimal APIs has been working in general for others, so I feel that this issue is something specific to how your project is set up (given how the exception isn't coming from our code).
We need something we can actually debug to look into to get towards any kind of resolution.
As a starting point, using the latest version will be a step forward you'll need as versions since 6.7.0 target net8.0 and also contain other bug fixes related to the CLI.
Support for Minimal APIs has been working in general for others, so I feel that this issue is something specific to how your project is set up (given how the exception isn't coming from our code).
Yeah this project doesn't use the minimal hosting - I'll try to find some time to replicate the issue but given it's intermittent it might be a struggle as the last instance I setup worked with no differences I could discern
Describe the bug
Have been following #2168 and have tried all the described solutions there, running locally this works fine, running in PR checks it works fine, but then when running a deploy this breaks.
I'm on .net8 using swashbuckle 6.5.0 (Have tried with original version 6.2.3 and newest 6.8.0 too) it seemed to happen somewhat intermittently in the past but retrying the workflow would eventually get it through however now it's failing continuously.
`dotnet-tools.json`
csproj
Action build step
Only difference between the PR check that works building the project and generating swagger json that I can discern is one is production, other is not but building in production locally works fine.
Expected behavior
Get a swagger openapi json spec
Actual behavior
Exception thrown
Steps to reproduce
No response
Exception(s) (if any)
Swashbuckle.AspNetCore version
6.2.3, 6.4.0, 6.5.0, 6.8.0
.NET Version
.net8.0
Anything else?
Have been looking at all the following
#2168
Tried having a blank
appsettings.Production.json
file but still threw same error along with the different suggested versionsHave followed
https://stackoverflow.com/questions/78406014/system-invalidoperationexception-a-type-named-startupproduction-or-startup
Trying the suggest env vars for the step, but inclusion of them didnt seem to work and confirmed the file path is correct (Worth noting I only tried adding these after it started failing as didnt need them before that point)
Please let me know if there's anything else I can provide
The text was updated successfully, but these errors were encountered: