aspnetcore: Microsoft.Extensions.ApiDescription.Server 3.0.0-rc1.19457.4 causes build to fail on macOS
Describe the bug
_Originally found via https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1266#issuecomment-533895107_
When Microsoft.Extensions.ApiDescription.Server is in the dependency tree of an ASP.NET Core 3.0 application, the application fails to build on macOS with the following error:
/Users/travis/.nuget/packages/microsoft.extensions.apidescription.server/3.0.0-rc1.19457.4/build/Microsoft.Extensions.ApiDescription.Server.targets(62,5): error : System.TimeoutException: Process /Users/travis/build/martincostello/api/.dotnetcli/dotnet timed out after 2 minutes. [/Users/travis/build/martincostello/api/src/API/API.csproj]
/Users/travis/.nuget/packages/microsoft.extensions.apidescription.server/3.0.0-rc1.19457.4/build/Microsoft.Extensions.ApiDescription.Server.targets(62,5): error : at Microsoft.Extensions.ApiDescription.Tool.Exe.Run(String executable, IReadOnlyList`1 args, IReporter reporter, String workingDirectory, Boolean interceptOutput) [/Users/travis/build/martincostello/api/src/API/API.csproj]
/Users/travis/.nuget/packages/microsoft.extensions.apidescription.server/3.0.0-rc1.19457.4/build/Microsoft.Extensions.ApiDescription.Server.targets(62,5): error : at Microsoft.Extensions.ApiDescription.Tool.Commands.InvokeCommand.Execute() [/Users/travis/build/martincostello/api/src/API/API.csproj]
/Users/travis/.nuget/packages/microsoft.extensions.apidescription.server/3.0.0-rc1.19457.4/build/Microsoft.Extensions.ApiDescription.Server.targets(62,5): error : at Microsoft.Extensions.ApiDescription.Tool.Commands.CommandBase.<>c__DisplayClass14_0.<Configure>b__0() [/Users/travis/build/martincostello/api/src/API/API.csproj]
/Users/travis/.nuget/packages/microsoft.extensions.apidescription.server/3.0.0-rc1.19457.4/build/Microsoft.Extensions.ApiDescription.Server.targets(62,5): error : at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) [/Users/travis/build/martincostello/api/src/API/API.csproj]
/Users/travis/.nuget/packages/microsoft.extensions.apidescription.server/3.0.0-rc1.19457.4/build/Microsoft.Extensions.ApiDescription.Server.targets(62,5): error : at Microsoft.Extensions.ApiDescription.Tool.ProgramBase.Run(String[] args, CommandBase command, Boolean throwOnUnexpectedArg) [/Users/travis/build/martincostello/api/src/API/API.csproj]
/Users/travis/.nuget/packages/microsoft.extensions.apidescription.server/3.0.0-rc1.19457.4/build/Microsoft.Extensions.ApiDescription.Server.targets(62,5): error MSB3073: The command "dotnet "/Users/travis/.nuget/packages/microsoft.extensions.apidescription.server/3.0.0-rc1.19457.4/build//../tools/dotnet-getdocument.dll" --assembly "/Users/travis/build/martincostello/api/src/API/bin/Release/netcoreapp3.0/API.dll" --file-list "obj/API.OpenApiFiles.cache" --framework ".NETCoreApp,Version=v3.0" --output "obj" --project "API" --assets-file "/Users/travis/build/martincostello/api/src/API/obj/project.assets.json" --platform "AnyCPU" " exited with code 1. [/Users/travis/build/martincostello/api/src/API/API.csproj]
The issue can be worked around by setting the following MSBuild property:
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
To Reproduce
Add the following NuGet package reference to an ASP.NET Core 3.0 application which has an API controller and build the application on macOS:
<PackageReference Include="Microsoft.Extensions.ApiDescription.Server" Version="3.0.0-rc1.19457.4" />
Expected behavior
The application builds successfully.
Additional context
This issue appears to only affect macOS, and not Windows or Linux. See this PR for different build behaviours: https://github.com/martincostello/api/pull/212
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 24 (16 by maintainers)
For those interested, the root cause is https://github.com/dotnet/corefx/issues/41740, and it is in fact a mac-only issue (at least in this specific instance).
FYI the dotnet/corefx#41740 fix was included in 3.1-preview2.
So, by paring down the “broken” app continuously until it match
dotnet new mvcI figured out what the proximal problem is here. In Program.cs.CreateHostBuilder if the call toUseApplicationInsightsis removed then everything starts to pass. We’ll be looking more into why that’s the case, but for now hopefully that can get anyone who’s trying to work with Swagger unblocked.The title of this issue is for MacOS, but I can confirm it exists on Windows too:
Severity Code Description Project File Line Suppression State Suppression State Error MSB3073 The command "dotnet “C:\Users\xxxxx.nuget\packages\microsoft.extensions.apidescription.server\0.3.0-preview7.19365.7\build/…/tools/dotnet-getdocument.dll” --assembly “C:\GitHub\Web-content.api.works24.com\content.api.works24.com\bin\Debug\netcoreapp3.0\content.api.works24.com.dll” --file-list “obj\content.api.works24.com.OpenApiFiles.cache” --framework “.NETCoreApp,Version=v3.0” --output “obj” --project “content.api.works24.com” --assets-file “C:\GitHub\Web-content.api.works24.com\content.api.works24.com\obj\project.assets.json” --platform “AnyCPU” " exited with code 7. content.api.xxxxx.com C:\Users\xxxxx.nuget\packages\microsoft.extensions.apidescription.server\0.3.0-preview7.19365.7\build\Microsoft.Extensions.ApiDescription.Server.targets 41