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
In a case where .NET version expected to be able to use dotnet swagger is not found, the output seems like it should be an error, but instead is just informational. This is causing issues when trying to use this in processes where an error is expected to fail the task appropriately, whether the failure occurs on writing the file or anything else around using dotnet swagger.
This seems to be a general issue, not relating to a specific version of the cli.
Repro:
ensure 'Microsoft.AspNetCore.App', version '5.0.0' is not installed
use swashbuckle version 6.1.4
ensure $ErrorActionPreference is set to default of Continue when running in Powershell
use dotnet swagger in try catch, see that error does not occur. Ex: try{dotnet swagger}catch{Write-Host "error occurred."}
Example:
PS C:\dev\> try{dotnet swagger}catch{Write-Host "error occurred."}
You must install or update .NET to run this application.
App: C:\Users\x\.nuget\packages\swashbuckle.aspnetcore.cli\6.1.4\tools\net5.0\any\dotnet-swagger.dll
Architecture: x64
Framework: 'Microsoft.AspNetCore.App', version '5.0.0' (x64)
.NET location: C:\Program Files\dotnet\
The following frameworks were found:
6.0.7 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=5.0.0&arch=x64&rid=win10-x64
PS C:\dev\>
Repro:
use swashbuckle version 6.4.0
ensure $ErrorActionPreference is set to default of Continue when running in Powershell
use dotnet swagger in try catch with a wrong path to assembly, see that error does not occur. Ex: try{dotnet swagger tofile --output unknown src\unknown.dll v1}catch{Write-Host "error occured."
An error is also not thrown when the assembly provided is not found:
PS C:\dev\> try{dotnet swagger tofile --output unknown src\unknown.dll v1}catch{Write-Host "error occured."}
Unhandled exception. System.IO.FileNotFoundException: src\unknown.dll
at Swashbuckle.AspNetCore.Cli.Program.<>c__DisplayClass0_0.<Main>b__2(IDictionary`2 namedArgs) in C:\projects\ahoy\src\Swashbuckle.AspNetCore.Cli\Program.cs:line 41
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
The text was updated successfully, but these errors were encountered:
swashbuckle version: 6.1.4 and 6.4.0
In a case where .NET version expected to be able to use
dotnet swagger
is not found, the output seems like it should be an error, but instead is just informational. This is causing issues when trying to use this in processes where an error is expected to fail the task appropriately, whether the failure occurs on writing the file or anything else around usingdotnet swagger
.This seems to be a general issue, not relating to a specific version of the cli.
Repro:
Continue
when running in Powershelltry{dotnet swagger}catch{Write-Host "error occurred."}
Example:
Repro:
Continue
when running in Powershelltry{dotnet swagger tofile --output unknown src\unknown.dll v1}catch{Write-Host "error occured."
An error is also not thrown when the assembly provided is not found:
The text was updated successfully, but these errors were encountered: