-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot dotnet format
ASP.NET Core projects
#1519
Comments
I had the same experience yesterday. |
|
uhm... interesting! I tried using this as the second stage in the Dockerfile and it builds just fine in my environment.
what SDK are you using in the csproj? |
Oops, I was inadvertently including an ASP.NET Core project when running |
I started noticing this problem yesterday. We have a test automation framework based on .NET 6 that gets built in Azure DevOps. We have a pipeline that runs to build the framework and check formatting whenever someone submits a PR.
As you can see, the pipeline uses whatever the most recent version of the SDK is. Since 6.0.200, the format task is generating this error:
I was able to replicate the same thing on my local machine once I upgraded to 6.0.200. The framework itself is a pretty simple solution with four projects using using |
- This change adjusts the .NET SDK version installed to be fixed to 6.0.102 to workaround issues with `dotnet format` (see dotnet/format#1519).
- This change adjusts the .NET SDK version installed to be fixed to 6.0.102 to workaround issues with `dotnet format` (see dotnet/format#1519).
I'm seeing this issue in repos without any ASP.NET Core projects. Hoping this can be fixed soon to unblock moving to newer SDK versions supporting Visual Studio 17.1. |
Also seeing this issue since I upgrade my sdk to 6.0.200 |
Also seeing this issue. What I found: <Project Sdk="Microsoft.NET.Sdk"> It does not work for <Project Sdk="Microsoft.NET.Sdk.Web"> as @ranma42 already mentioned. |
For me In my case |
as pointed out in #1521 docker images for 6.0.200 have been released, so the reproducer is now much simpler: FROM mcr.microsoft.com/dotnet/sdk:6.0.200 AS my-test
WORKDIR /app
RUN dotnet new webapp
RUN dotnet format -v diag --verify-no-changes (note that this is the full Dockerfile, not the second stage of the build) |
Install dotnet-format |
@lsaudon The dotnet format command is now part of the dotnet 6.0 sdk so installing the separate dotnet-format tool should not be required - and indeed this worked with the 6.0.102 release - breaking changes should not be introduced in patch releases. |
I know dotnet format is a part of the dotnet 6.0, but what is more important security patch or format code ? |
The matters are being conflated - Generally the CI/CD process where dotnet format gets run and where an app is hosted are different environments. The patch addresses a DoS vulnerability in runtime/hosting environments which generally isn't a vulnerability in CI/CD processes. However, that same patch shouldn't break shouldn't break everyone's CI/CD processes that run dotnet format. What you describe in installing the dotnet-format global tool is a workaround, and it may be a valid, good workaround, but it doesn't "Solve the problem" The reason that myself and possibly others are here is because the dotnet format commands in my CI/CD pipelines are now broken because of this patch release and that needs to be addressed. |
The workaround of using the tool
Seems to bring the same error for me. Although in my case I have it as a local tool not global. |
v6.0.200 breaks dotnet-format See dotnet/format#1519
Is there an eta for a fix on this? There are a lot of issues being opened and this seems like a blocking issue for many. |
I had the same issue on .NET 7 preview 1 OS: Windows Diagnostic logs are as follows:
|
@justinmchase I hit it in all 3 (macOS, Ubuntu, and Windows) on my projects. Perhaps your Jenkins Ubuntu build isn't using 6.0.20x? |
@justinmchase Well I guess when you call |
@craigktreasure You are correct, despite me attempting to set it to 201 its actually pulling an older version:
|
- Due to dotnet/sdk#23972 and dotnet/format#1519, i'm going to start using the `dotnet-format` tool instead of the version integrated into the SDK.
- Due to dotnet/sdk#23972 and dotnet/format#1519, i'm going to start using the `dotnet-format` tool instead of the version integrated into the SDK.
* Revert "Change .NET SDK version to a fixed version (#52)" This reverts commit c05605a. * Update to latest .NET 6 SDK * Use `dotnet-format` - Due to dotnet/sdk#23972 and dotnet/format#1519, i'm going to start using the `dotnet-format` tool instead of the version integrated into the SDK.
This will be fixed tin the 6.0.202 SDK release. I will leave this issue open until that release is downloadable. |
@jmarolf Thanks for the info that it will be fixed in a future release! Can you tell us if there is an ETA? It doesn' t need to be to precise. Only if we are talking about hours, days, weeks or even months? |
Servicing runs on a monthly cadence, so if it's not in the next patch-Tuesday release, it's likely going to be in the release after that. |
Another workaround that has worked for me (if tool is installed locally) is to run: |
The .NET 6.0.202 SDK has been released. |
* Update Solution to .Net 6 * Dedupe Functions Csproj config for function version. * update build CI config to windows-latest which include latest vs2022 and .net6 SDK * Update to windows-2022. windows-latest is not there yet. * Configure build pipeline for ubuntu-latest * Update VmImage to windows-2022 as windows-latest does not have .net6 * update Cosmos pipeline to use windows-2022 * Dockerfile set dotnet version to 6.0 * Remove custom install dotnet format tool build step as it is included in .NET6 * Update dependencies * dotnet/format#1519 is fixed so unpinning sdk version * adding dotnet tool installer task Co-authored-by: Aaron Powell <[email protected]>
After upgrading to 6.0.2 (6.0.200) I got errors when trying to format projects using the web SDK, i.e.
Initially I assumed that I had something wrong or unexpected in the project I was working on and/or in my environment, as the error is basically the same as that in #1500; unfortunately in my case even removing all other SDKs did not fix the issue.
EDIT: since the report, new docker images have been released; the reproducer is now much simpler: #1519 (comment)
I tried to reproduce it using one of the standard docker images, but the latest ones are 6.0.102, not 6.0.200, so I wrote this Dockerfile. Its first stage is based on https://github.com/dotnet/dotnet-docker/blob/17971807fc0f4ff5a0eca53deb2d85fff990d95c/src/sdk/6.0/bullseye-slim/amd64/Dockerfile updating just DOTNET_SDK_VERSION and dotnet_sha512
The second stage is the actual reproducer: it creates a simple webapp (from the template) and tries to format it
This reliably reproduces the issue and results in the errors:
I am unsure if this is actually a
dotnet format
problem or some kind of packaging issue of the SDK.In the second case, sorry for the noise 😇
The text was updated successfully, but these errors were encountered: