-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
BuildX for arm64 on .Net 7.0 is broken #28971
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
I have the same issue too, it’s blocking us right now. |
This appears to be a bug with NuGet running with QEMU (Quick Emulator). QEMU is being used here by Docker because you're running Arm64 on an x64 host machine. In the meantime, let's talk about a workaround. You'll want to avoid emulation by not using a multi-arch tag for the sdk. To do this, you can use the But because you're explicitly using the amd64 version of the sdk image, you'll need to explicitly set the RID in the And there's one little gotcha with the architecture. In order to make it a truly multi-arch Dockerfile, you'd also need to account for when you specify Note that in the Dockerfile below I make use of the Example: FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim-amd64 AS build
ARG TARGETARCH
ARG TARGETOS
RUN arch=$TARGETARCH \
&& if [ "$arch" = "amd64" ]; then arch="x64"; fi \
&& echo $TARGETOS-$arch > /tmp/rid
WORKDIR /source
COPY *.csproj .
RUN dotnet restore -r $(cat /tmp/rid)
COPY . .
RUN dotnet publish -c Release -o /app -r $(cat /tmp/rid) --self-contained false --no-restore
FROM mcr.microsoft.com/dotnet/runtime:7.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "dotnetapp.dll"] |
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
I've just moved this to the sdk repo to have that team take a look. |
I've tracked this down to 7.0 Preview 3. In that version, this scenario was broken. It was working in Preview 2. |
@mthalman are you saying this has been broken since 7.0.100-preview3? I'm not sure I quite follow the scenario that's broken. Are you saying this is an amd64 SDK on arm64 or some other configuration? From the error message, the error appears to be coming from an msbuild intrinsic function. @benvillalobos to take a look since this involves arm64. Ben, is there any way to get the exception that's thrown by msbuild here? |
That's correct. And it was working in Preview 2. I verified this by changing the tag name used for the sdk image. Instead of the
This an Arm64 Docker container running on an x64 host machine. Docker uses QEMU to do this. |
I have the issue with buildx saying: |
At first glance I would pin this on the NuGet assembly. In this intrinsic function MSBuild reflects over I'm not sure if there's a way to get more info from the exception without debugging into the intrinsic method. @rainersigwald might know of some msbuild magic here. |
I don't see anything that would get better info: dotnet/msbuild#8151. @benvillalobos you could try to repro with a private MSBuild that dumps the whole stack. That should be easier than trying to attach a debugger to the emulated ARM64 process inside the container. |
Thanks for creating this issue! We believe this issue is related to NuGet tooling, which is maintained by the NuGet team. Thus, we closed this one and encourage you to raise this issue in the NuGet repository instead. Don’t forget to check out NuGet’s contributing guide before submitting an issue! If you believe this issue was closed out of error, please comment to let us know. Happy Coding! |
I've created a new issue for this at: NuGet/Home#12227 |
* build arm image * pin sdk version to preview 2 to avoid a bug - dotnet/sdk#28971 * comment
For everyone who found this ticket - read an explanation - https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support/ |
When try to build arm64 containers using .Net7 results in a error on restore step.
Just create a new web api for example with .Net7 as target framework and try to build it with buildx. For amd64 build works just fine.
Docker Version
Docker Info
The text was updated successfully, but these errors were encountered: