Formatting in EditorConfig not respected on .NET Core SDK 2.1
- Dominant language
- No language data
- Stars
- 1.9k
- Forks
- 173
- Avg merge
- 10d 13h
- Merged PRs (30d)
- 1
Description
Latest public dotnet format (4.1.131201) does not respect C# formatting in EditorConfig and thus reports `Fix whitespace formatting` on .NET Core SDK 2.1 - despite an EditorConfig saying otherwise. It works as intended on .NET Core SDK 3.1.
`.editorconfig`
```
[*.cs]
csharp_space_after_cast = true
```
`Sample.csproj`
```
netstandard2.0
```
`Foo.cs`
```
namespace Sample
{
class Foo
{
void Bar()
{
var baz = (float) 2;
}
}
}
```
Execution in Docker container:
```
$ docker run -it --rm -v `pwd`:/build mcr.microsoft.com/dotnet/core/sdk:2.1 bash
root@7ff0fb510db5:/# cd build/
root@7ff0fb510db5:/build# dotnet tool install -g dotnet-format
Tools directory '/root/.dotnet/tools' is not currently on the PATH environment variable.
If you are using bash, you can add it to your profile by running the following command:
cat << \EOF >> ~/.bash_profile
# Add .NET Core SDK tools
export PATH="$PATH:/root/.dotnet/tools"
EOF
You can add it to the current session by running the following command:
export PATH="$PATH:/root/.dotnet/tools"
You can invoke the tool using the following command: dotnet-format
Tool 'dotnet-format' (version '4.1.131201') was successfully installed.
root@7ff0fb510db5:/build# export PATH="$PATH:/root/.dotnet/tools"
root@7ff0fb510db5:/build# dotnet format --check
Formatting code files in workspace '/build/Sample.csproj'.
Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings.
Program.cs(7,30): Fix whitespace formatting.
Formatted code file '/build/Foo.cs'.
Format complete in 2195ms.
root@7ff0fb510db5:/build#
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.