dotnet / dotnet/docfx

csproj issues are wrapped as warning instead of errors (can't auto-detect such issues with CI)

Open
#8,000 6 comments 0 reactions 0 assignees View on GitHub
dotnet dotnet: msbuild
Dominant language
C#
Stars
4.4k
Forks
890
Avg merge
2h 11m
Merged PRs (30d)
10

Description

**Operating System**: `Windows`
**DocFX Version Used**: 2.59.2

**Steps to Reproduce**:

1. Create a csproj file.
2. Change `Microsoft.NET.Sdk` to a non-existing framework, i.e. `Microsoft.NET.Sdk2`
3. Run docfx metadata on it (i.e. `docfx metadata test.csproj`)

**Expected Behavior**:

Error and invalid exit code (so that it can easily be caught up by any continuous integration tool)

**Actual Behavior**:

Error wrapped as warning, proper exit code (error silently ignored)
```
[22-04-30 02:15:37.644]Warning:[ExtractMetadata](C:/dev/stride/sources/core/Stride.Core/Stride.Core.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file 'C:\dev\stride\sources\core\Stride.Core\Stride.Core.csproj' with message: The SDK 'Microsoft.NET.Sdk2' specified could not be found. C:\dev\stride\sources\targets\Stride.Core.props
[22-04-30 02:15:37.958]Warning:[ExtractMetadata]Project 'C:\dev\stride\sources\core\Stride.Core\Stride.Core.csproj' does not contain any documents.
[22-04-30 02:15:37.974]Info:[ExtractMetadata]Generating metadata for each project...
[22-04-30 02:15:38.289]Warning:[ExtractMetadata]No metadata is generated for Stride.Core.
[22-04-30 02:15:38.289]Info:Completed in 2537.999 milliseconds

Build succeeded with warning.
[22-04-30 02:15:38.289]Warning:[ExtractMetadata](C:/dev/stride/sources/core/Stride.Core/Stride.Core.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file 'C:\dev\stride\sources\core\Stride.Core\Stride.Core.csproj' with message: The SDK 'Microsoft.NET.Sdk2' specified could not be found. C:\dev\stride\sources\targets\Stride.Core.props
[22-04-30 02:15:38.289]Warning:[ExtractMetadata]Project 'C:\dev\stride\sources\core\Stride.Core\Stride.Core.csproj' does not contain any documents.
[22-04-30 02:15:38.289]Warning:[ExtractMetadata]No metadata is generated for Stride.Core.
3 Warning(s)
0 Error(s)
```

We can see that there is a Failure, but it's wrapped as a warning by extract metadata: `Warning:[ExtractMetadata] (xxx.csproj)Workspace failed with: [Failure] yyy`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.