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
If I then in my project working directory run this command: npx nswag aspnetcore2openapi /output:./test.swagger
it yells at me:
NSwag NPM CLI
NSwag command line tool for .NET Core Net80, toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: /Users/zyber/.npm/_npx/58e08e1c8752b753/node_modules/nswag/bin/binaries/Net80
Executing dotnet exec --depsfile /Users/zyber/RiderProjects/NswagMinimumExample/NswagMinimumExample/bin/Debug/net8.0/NswagMinimumExample.deps.json --runtimeconfig /Users/zyber/RiderProjects/NswagMinimumExample/NswagMinimumExample/bin/Debug/net8.0/NswagMinimumExample.runtimeconfig.json /Users/zyber/.npm/_npx/58e08e1c8752b753/node_modules/nswag/bin/binaries/Net80/NSwag.AspNetCore.Launcher.dll /var/folders/lw/nll50n7s615bktfmrr9czhrh0000gn/T/tmpeL4gwa.tmp /var/folders/lw/nll50n7s615bktfmrr9czhrh0000gn/T/tmphOInUr.tmp NswagMinimumExample /Users/zyber/.npm/_npx/58e08e1c8752b753/node_modules/nswag/bin/binaries/Net80/
Launcher directory: /Users/zyber/.npm/_npx/58e08e1c8752b753/node_modules/nswag/bin/binaries/Net80
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.AggregateException: One or more errors occurred. (Changing the URL is not supported because no valid IServerAddressesFeature was found.)
---> System.InvalidOperationException: Changing the URL is not supported because no valid IServerAddressesFeature was found.
at Microsoft.AspNetCore.Builder.WebApplication.Listen(String url)
at Microsoft.AspNetCore.Builder.WebApplication.Run(String url)
at Program.<Main>$(String[] args) in /Users/zyber/RiderProjects/NswagMinimumExample/NswagMinimumExample/Program.cs:line 16
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at NSwag.Commands.ServiceProviderResolver.GetServiceProviderWithHostFactoryResolver(Assembly assembly) in /_/src/NSwag.Commands/HostApplication.cs:line 171
at NSwag.Commands.ServiceProviderResolver.GetServiceProvider(Assembly assembly) in /_/src/NSwag.Commands/HostApplication.cs:line 70
at NSwag.Commands.Generation.AspNetCore.AspNetCoreToOpenApiGeneratorCommandEntryPoint.Process(String commandContent, String outputFile, String applicationName) in /_/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiGeneratorCommandEntryPoint.cs:line 27
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at NSwag.AspNetCore.Launcher.Program.Main(String[] args) in /_/src/NSwag.AspNetCore.Launcher/Program.cs:line 132
Done executing command. Exit Code: 1.
System.InvalidOperationException: Swagger generation failed with non-zero exit code '1'.
at NSwag.Commands.Generation.AspNetCore.AspNetCoreToOpenApiCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs:line 195
at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input)
at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input)
at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in /_/src/NSwag.Commands/NSwagCommandProcessor.cs:line 65node:child_process:960
throw err;
^
Error: Command failed: dotnet "/Users/zyber/.npm/_npx/58e08e1c8752b753/node_modules/nswag/bin/binaries/Net80/dotnet-nswag.dll" aspnetcore2openapi /output:./test.swagger
at checkExecSyncError (node:child_process:885:11)
at Object.execSync (node:child_process:957:15)
at /Users/zyber/.npm/_npx/58e08e1c8752b753/node_modules/nswag/bin/nswag.js:62:27
at ChildProcess.exithandler (node:child_process:411:7)
at ChildProcess.emit (node:events:514:28)
at maybeClose (node:internal/child_process:1091:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
status: 255,
signal: null,
output: [ null, null, null ],
pid: 34824,
stdout: null,
stderr: null
}
Node.js v18.17.1
nswag version:
% npx nswag version
NSwag NPM CLI
NSwag command line tool for .NET Core Net80, toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: /Users/zyber/.npm/_npx/58e08e1c8752b753/node_modules/nswag/bin/binaries/Net80
NSwag version: 14.1.0.0
NJsonSchema version: 11.0.2.0 (Newtonsoft.Json v13.0.0.0)
However, I can start the project and run it, access Swagger UI with the correct endpoint data.
If I move http://*:5000 from app.Run() into Services.Webhost.UseUrls() it works, but I'd like to avoid that - as I would use this in a "common" package amongst several services, and I'd like it to be a drop in replacement.
Is this the intended behavior? I've failed to find any documentation with regards to this.
The text was updated successfully, but these errors were encountered:
Hello,
If I start my Aspnetcore app and use
app.Run("http://*:5000")
in my app,nswag aspnetcore2openapi
crashes.Minimum example to recreate the issue,
Program.cs
project.csproj:
If I then in my project working directory run this command:
npx nswag aspnetcore2openapi /output:./test.swagger
it yells at me:
nswag version:
However, I can start the project and run it, access Swagger UI with the correct endpoint data.
If I move
http://*:5000
fromapp.Run()
intoServices.Webhost.UseUrls()
it works, but I'd like to avoid that - as I would use this in a "common" package amongst several services, and I'd like it to be a drop in replacement.Is this the intended behavior? I've failed to find any documentation with regards to this.
The text was updated successfully, but these errors were encountered: