dotnet / dotnet/format

dotnet format `--verbosity` switch breaks `--verify-no-changes`

Open
#1,648 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

I came across this while testing it in our CI Environment:

If you have an `.editorconfig` enforcing `LF` line endings and a file wich is `CRLF`.

You run `dotnet format .\Project.sln --verify-no-changes` it errors as expected.

If you run `dotnet format .\Project.sln --verify-no-changes --verbosity diagnostic` it does not error and instead formats your files.

See attached log for reference:

```bash
dotnet format .\Project.sln --verify-no-changes --verbosity diagnostic
The dotnet runtime version is '6.0.5'.
The dotnet CLI version is '6.0.300'.
Using MSBuild.exe located in 'C:\Program Files\dotnet\sdk\6.0.300\'.
Formatting code files in workspace 'C:\Develop\Path\Project.sln'.
Loading workspace.
Determining projects to restore...
All projects are up-to-date for restore.
Msbuild failed when processing the file 'C:\Develop\Path\ASP.NET\WebApp\WebApp.csproj' with message: The imported project "C:\Program Files\dotnet\sdk\6.0.300\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\6.0.300\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk. C:\Develop\Path\ASP.NET\WebApp\WebApp.csproj
Found project reference without a matching metadata reference: C:\Develop\Path\NetStandardUtils\NetStandardUtils.csproj
Found project reference without a matching metadata reference: C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj
Found project reference without a matching metadata reference: C:\Develop\Path\ASP.NET\Interface.Base\Interface.Base.csproj
Found project reference without a matching metadata reference: C:\Develop\Path\ASP.NET\Interface.DataContracts\Interface.DataContracts.csproj
Found project reference without a matching metadata reference: C:\Develop\Path\ASP.NET\Interface.Entities\Interface.Entities.csproj
Found project reference without a matching metadata reference: C:\Develop\Path\ASP.NET\Interface.Project\Interface.Project.csproj
Msbuild failed when processing the file 'C:\Develop\Path\ASP.NET\Tools\HierarchyExplorer\HierarchyExplorer.csproj' with message: C:\Develop\Path\ASP.NET\WebApp\WebApp.csproj: (2745, 3): The imported project "C:\Program Files\dotnet\sdk\6.0.300\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\6.0.300\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk.
Found project reference without a matching metadata reference: C:\Develop\Path\ASP.NET\BusinessLogic\BusinessLogic.csproj
Found project reference without a matching metadata reference: C:\Develop\Path\ASP.NET\WebApp\WebApp.csproj
Found project reference without a matching metadata reference: C:\Develop\Path\ASP.NET\Project-Service\Project-Service.csproj
Found project reference without a matching metadata reference: C:\Develop\Path\Tests\TestUtils\TestUtils.csproj
Found project reference without a matching metadata reference: C:\Develop\Path\ASP.NET\Deployment\InstallSteps\InstallSteps.csproj
Project BusinessLogic(net48) is using configuration from 'C:\Develop\Path\.editorconfig'.
Project BusinessLogic(net48) is using configuration from 'C:\Develop\Path\ASP.NET\BusinessLogic\obj\Debug\net48\BusinessLogic.GeneratedMSBuildEditorConfig.editorconfig'.
Project BusinessLogic(netstandard2.1) is using configuration from 'C:\Develop\Path\.editorconfig'.
Project BusinessLogic(netstandard2.1) is using configuration from 'C:\Develop\Path\ASP.NET\BusinessLogic\obj\Debug\netstandard2.1\BusinessLogic.GeneratedMSBuildEditorConfig.editorconfig'.
Project HierarchyExplorer is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Encrypt is using configuration from 'C:\Develop\Path\.editorconfig'.
Project IntegrationTests is using configuration from 'C:\Develop\Path\.editorconfig'.
Project DevInstaller is using configuration from 'C:\Develop\Path\.editorconfig'.
Project InstallSteps is using configuration from 'C:\Develop\Path\.editorconfig'.
Project TestUtils is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Interface.Entities is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Interface.Project is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Interface.Base is using configuration from 'C:\Develop\Path\.editorconfig'.
Project ImportOrganizationStructure is using configuration from 'C:\Develop\Path\.editorconfig'.
Project EncryptUserPasswords is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Interface.DataContracts is using configuration from 'C:\Develop\Path\.editorconfig'.
Project TestConsole is using configuration from 'C:\Develop\Path\.editorconfig'.
Project AnalyzeContingents is using configuration from 'C:\Develop\Path\.editorconfig'.
Project ResetUserPasswords is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Interface.MapQuest is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Project-Service is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Installer is using configuration from 'C:\Develop\Path\.editorconfig'.
Project BasisImportScriptGenerator is using configuration from 'C:\Develop\Path\.editorconfig'.
Project InstallTestData is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Project-API is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Project-API is using configuration from 'C:\Develop\Path\Project-API\obj\Debug\net6.0\Project-API.GeneratedMSBuildEditorConfig.editorconfig'.
Project Project-API is using configuration from 'C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk\analyzers\build\config\analysislevel_6_default.editorconfig'.
Project NetStandardUtils(net48) is using configuration from 'C:\Develop\Path\.editorconfig'.
Project NetStandardUtils(net48) is using configuration from 'C:\Develop\Path\NetStandardUtils\obj\Debug\net48\NetStandardUtils.GeneratedMSBuildEditorConfig.editorconfig'.
Project NetStandardUtils(netstandard2.0) is using configuration from 'C:\Develop\Path\.editorconfig'.
Project NetStandardUtils(netstandard2.0) is using configuration from 'C:\Develop\Path\NetStandardUtils\obj\Debug\netstandard2.0\NetStandardUtils.GeneratedMSBuildEditorConfig.editorconfig'.
Project Data.Entities(net48) is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Data.Entities(net48) is using configuration from 'C:\Develop\Path\ASP.NET\Data.Entities\obj\Debug\net48\Data.Entities.GeneratedMSBuildEditorConfig.editorconfig'.
Project Data.Entities(netstandard2.1) is using configuration from 'C:\Develop\Path\.editorconfig'.
Project Data.Entities(netstandard2.1) is using configuration from 'C:\Develop\Path\ASP.NET\Data.Entities\obj\Debug\netstandard2.1\Data.Entities.GeneratedMSBuildEditorConfig.editorconfig'.
Complete in 3950ms.
Determining formattable files.
Complete in 1231ms.
Running formatters.
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(1,86): error ENDOFLINE: Fix end of line marker. Replace 4 characters with '\n\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(3,42): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(4,2): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(5,27): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(6,3): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(7,38): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(8,38): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(9,41): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(10,43): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(11,44): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(12,39): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(13,41): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(14,38): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(15,3): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs(16,2): error ENDOFLINE: Fix end of line marker. Replace 2 characters with '\n'. [C:\Develop\Path\ASP.NET\Data.Entities\Data.Entities.csproj]
Running Code Style analysis.
Determining diagnostics...
Required references did not load for WebApp or referenced project. Run `dotnet restore` prior to formatting.
Running 2 analyzers on BusinessLogic(net48).
Running 2 analyzers on BusinessLogic(netstandard2.1).
Required references did not load for HierarchyExplorer or referenced project. Run `dotnet restore` prior to formatting.
Running 2 analyzers on Encrypt.
Running 2 analyzers on IntegrationTests.
Running 2 analyzers on DevInstaller.
Running 2 analyzers on InstallSteps.
Running 2 analyzers on TestUtils.
Running 2 analyzers on Interface.Entities.
Running 2 analyzers on Interface.Project.
Running 2 analyzers on Interface.Base.
Running 2 analyzers on ImportOrganizationStructure.
Running 2 analyzers on EncryptUserPasswords.
Running 2 analyzers on Interface.DataContracts.
Running 2 analyzers on TestConsole.
Running 2 analyzers on AnalyzeContingents.
Running 2 analyzers on ResetUserPasswords.
Running 2 analyzers on Interface.MapQuest.
Running 2 analyzers on Project-Service.
Running 2 analyzers on Installer.
Running 2 analyzers on BasisImportScriptGenerator.
Running 2 analyzers on InstallTestData.
Running 2 analyzers on Project-API.
Running 2 analyzers on NetStandardUtils(net48).
Running 2 analyzers on NetStandardUtils(netstandard2.0).
Running 2 analyzers on Data.Entities(net48).
Running 2 analyzers on Data.Entities(netstandard2.1).
Complete in 4377ms.
Analysis complete in 4377ms.
Running Analyzer Reference analysis.
Determining diagnostics...
Running 143 analyzers on Project-API.
Complete in 227ms.
Analysis complete in 227ms.
Complete in 5713ms.
Formatted code file 'C:\Develop\Path\ASP.NET\Data.Entities\Types\DailyInterval.cs'.
Formatted 1 of 1212 files.
Format complete in 10894ms
```

* I had to replace parts of the output with `Path` or `Project`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.