Skip to content
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 build ASP.NET Core 7 app for Raspberry Pi 4 #46306

Closed
1 task done
mu88 opened this issue Jan 28, 2023 · 15 comments
Closed
1 task done

Cannot build ASP.NET Core 7 app for Raspberry Pi 4 #46306

mu88 opened this issue Jan 28, 2023 · 15 comments
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Comments

@mu88
Copy link

mu88 commented Jan 28, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Hey 👋🏻

I’ve been using the Docker image mu88/shopandeat:latest (an ASP.NET Core app) for years on my Raspberry Pi 4. One month ago, I switched to ASP NET Core 7.0 and everything worked smoothly.

Last week I made a little fix in the app and created a new version of mu88/shopandeat:latest. When trying to pull this image on my Raspi via docker pull mu88/shopandeat:latest, this fails with:

latest: Pulling from mu88/shopandeat
no matching manifest for linux/arm64/v8 in the manifest list entries

Which is strange because when logging into Docker Hub it seems to be okay:
image

I'm building my app via GitHub Actions:

So I've opened this issue in the Docker community forum. After some back and forth we discovered that when setting the platform parameter for docker build to linux/arm64 or linux/arm64/v8, dotnet build fails with cryptic errors in the .NET compilation part of my Dockerfile:

#18 [build 12/12] RUN dotnet build "ShopAndEat.csproj" -c Release -o /app/build
#18 5.256 MSBuild version 17.4.1+9a89d02ff for .NET
#18 14.52   Determining projects to restore...
#18 27.92   All projects are up-to-date for restore.
#18 32.74 /usr/share/dotnet/sdk/7.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(120,5): error MSB4018: The "AllowEmptyTelemetry" task failed unexpectedly. [/src/BizLogic/BizLogic.csproj]
#18 32.74 /usr/share/dotnet/sdk/7.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(120,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object. [/src/BizLogic/BizLogic.csproj]
#18 32.75 /usr/share/dotnet/sdk/7.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(120,5): error MSB4018:    at InvokeStub_AllowEmptyTelemetry.set_EventData(Object, Object, IntPtr*) [/src/BizLogic/BizLogic.csproj]
#18 32.75 /usr/share/dotnet/sdk/7.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(120,5): error MSB4018:    at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr) [/src/BizLogic/BizLogic.csproj]
#18 32.75 /usr/share/dotnet/sdk/7.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(120,58): error MSB4026: The "EventData=TargetFrameworkVersion=$([MSBuild]::Escape('$(TargetFrameworkMoniker)'));RuntimeIdentifier=$(RuntimeIdentifier);SelfContained=$(SelfContained);UseApphost=$(UseApphost);OutputType=$(OutputType)" parameter for the "AllowEmptyTelemetry" task is invalid. [/src/BizLogic/BizLogic.csproj]

I've attached the GitHub Actions build log.

Expected Behavior

I can build my ASP.NET Core app on GitHub Actions, set the latest tag on Docker Hub, pull it onto my Raspberry Pi 4 and successfully start the app.

Steps To Reproduce

  • Create an environment similar to GitHub Actions
  • Run the CI pipeline CI.yml

Exceptions (if any)

The following error occurs when build the Docker image via GitHub Actions with --platform linux/arm64:

#15 20.77 /usr/share/dotnet/sdk/7.0.102/NuGet.targets(1179,7): error MSB4018: The "MSBuild" task failed unexpectedly. [/src/DataLayer/DataLayer.csproj]
#15 20.77 /usr/share/dotnet/sdk/7.0.102/NuGet.targets(1179,7): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object. [/src/DataLayer/DataLayer.csproj]
#15 20.77 /usr/share/dotnet/sdk/7.0.102/NuGet.targets(1179,7): error MSB4018:    at InvokeStub_MSBuild.get_TargetOutputs(Object, Object, IntPtr*) [/src/DataLayer/DataLayer.csproj]
#15 20.77 /usr/share/dotnet/sdk/7.0.102/NuGet.targets(1179,7): error MSB4018:    at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr) [/src/DataLayer/DataLayer.csproj]

.NET Version

7.0.102

Anything else?

  • Platform information:
    • Hardware: Raspberry Pi 4
    • OS: Raspberry Pi OS / x64 / 11 (bullseye)
    • Docker version 20.10.23, build 7155243
  • ASP.NET Core 7
@adityamandaleeka
Copy link
Member

adityamandaleeka commented Jan 30, 2023

cc @richlander @MichaelSimons Can you please help route this issue?

@richlander
Copy link
Member

richlander commented Jan 31, 2023

I took a look at the images and your CI log. Is there a reason why your CI needs to run in QEMU. .NET doesn't work well in QEMU. That may be why you have all those errors. Stating the obvious: uploading your image to a registry w/all those errors isn't useful.

Can you build the image cleanly on raw metal, for both x64 and Arm64? Also, in most cases, you can build .NET images for other architectures w/o using QEMU.

@mu88
Copy link
Author

mu88 commented Jan 31, 2023

Thank you for taking a look into my issue, @richlander ! So I've disabled the QEMU step in my GitHub Actions, but the build still fails with exactly the same MSBuild errors

@richlander
Copy link
Member

Can you validate that it all
Works if you use a 7.0.0 or 7.0.1 SDK image?

@mu88
Copy link
Author

mu88 commented Feb 1, 2023

Version of dotnet/aspnet Version of dotnet/sdk QEMU enabled GitHub Action result
7.0.0-rc.2-bullseye-slim-arm64v8 7.0.100-rc.2-bullseye-slim-arm64v8 No Failure
7.0.0-rc.2-bullseye-slim-arm64v8 7.0.100-rc.2-bullseye-slim-arm64v8 Yes Failure
7.0.1-bullseye-slim-arm64v8 7.0.101-bullseye-slim-arm64v8 No Failure

@richlander
Copy link
Member

richlander commented Feb 2, 2023

Does your code build correctly on your local machine (at the same commit)?

BTW: No need to use RC2. 7.0.0 would have also been fine.

@mu88
Copy link
Author

mu88 commented Feb 2, 2023

Yes, on my local Win11 machine everything is working smoothly

@richlander
Copy link
Member

mu88/ShopAndEat#36

@mu88
Copy link
Author

mu88 commented Feb 3, 2023

The build is still failing on GitHub Actions with:

#15 [build  9/12] RUN dotnet restore "ShopAndEat/ShopAndEat.csproj"
#15 13.30   Determining projects to restore...
#15 20.14 /usr/share/dotnet/sdk/7.0.101/NuGet.targets(1179,7): error MSB4018: The "MSBuild" task failed unexpectedly. [/src/DataLayer/DataLayer.csproj]
#15 20.14 /usr/share/dotnet/sdk/7.0.101/NuGet.targets(1179,7): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object. [/src/DataLayer/DataLayer.csproj]
#15 20.15 /usr/share/dotnet/sdk/7.0.101/NuGet.targets(1179,7): error MSB4018:    at InvokeStub_MSBuild.get_TargetOutputs(Object, Object, IntPtr*) [/src/DataLayer/DataLayer.csproj]
#15 20.15 /usr/share/dotnet/sdk/7.0.101/NuGet.targets(1179,7): error MSB4018:    at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr) [/src/DataLayer/DataLayer.csproj]

@richlander
Copy link
Member

richlander commented Feb 3, 2023

@richlander
Copy link
Member

I made another PR for you. A colleague pointed out that my first one wasn't correct.

mu88/ShopAndEat#37

@mu88
Copy link
Author

mu88 commented Feb 4, 2023

Thank you @richlander for spending your precious time with my little project! I really appreciate it.

You'll notice that I've closed your PR and here's why: two days ago, I made a little fix in one of my other apps which has exactly the same setting like this one. And know what? I was able build and push it via GitHub Actions and pull and run it on my Raspi - without any issues at all.
That's why I decided to go back to my very first Dockerfile's/GitHub Action's draft and delete all existing Docker tags of mu88/shopandeat. And now I can build, push, pull and run this app as well again 🥳

So I don't know what happened to mu88/shopandeat:latest, but it somehow became corrupt 🤷🏻‍♂️

So once again a big thank you for your help!

@mu88 mu88 closed this as completed Feb 4, 2023
@richlander
Copy link
Member

No worries. All good. I really appreciate you reporting the issue. I think our guidance is actually a bit wrong so I'm going to work on that now, so thanks for the insight on that.

@richlander
Copy link
Member

@richlander
Copy link
Member

@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

No branches or pull requests

5 participants