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

NRE in System.Text.RegularExpresssions on ARM64 #78340

Closed
anmalkov opened this issue Nov 11, 2022 · 21 comments
Closed

NRE in System.Text.RegularExpresssions on ARM64 #78340

anmalkov opened this issue Nov 11, 2022 · 21 comments

Comments

@anmalkov
Copy link

anmalkov commented Nov 11, 2022

Steps to reproduce

  1. Create a new app in VS from template "ASP.NET Core with React.js"
  2. Name a project and solution as "testspa"
  3. Select .NET 7
  4. Create Dockerfile in the solution file directory:
FROM mcr.microsoft.com/dotnet/aspnet:7.0-jammy-arm64v8 AS base
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y libpng-dev libjpeg-dev curl libxi6 build-essential libgl1-mesa-glx
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get install -y nodejs
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0-jammy-arm64v8 AS build
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y libpng-dev libjpeg-dev curl libxi6 build-essential libgl1-mesa-glx
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get install -y nodejs
WORKDIR /src
COPY ["testspa/testspa.csproj", "testspa/"]
RUN dotnet restore "testspa/testspa.csproj"
COPY . .
WORKDIR "/src/testspa"
RUN dotnet build "testspa.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "testspa.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "testspa.dll"]
  1. Open terminal and go to solution directory
  2. Build an image:
docker build -t testspa .

Expected result:

A solution should be built and container image should be created

Actual result:

dotnet restore command fails with:

------
 > [build  9/12] RUN dotnet restore "testspa/testspa.csproj":
dotnet/msbuild#21 15.85 MSBUILD : error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled. [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :     System.NullReferenceException: Object reference not set to an instance of an object. [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Regex1_Scan(RegexRunner, ReadOnlySpan`1) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at System.Text.RegularExpressions.Regex.ScanInternal(RegexRunnerMode mode, Boolean reuseMatchObject, String input, Int32 beginning, RegexRunner runner, ReadOnlySpan`1 span, Boolean returnNullIfReuseMatchObject) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at System.Text.RegularExpressions.Regex.RunAllMatchesWithCallback[TState](String inputString, ReadOnlySpan`1 inputSpan, Int32 startat, TState& state, MatchCallback`1 callback, RegexRunnerMode mode, Boolean reuseMatchObject) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at System.Text.RegularExpressions.Regex.RunAllMatchesWithCallback[TState](String input, Int32 startat, TState& state, MatchCallback`1 callback, RegexRunnerMode mode, Boolean reuseMatchObject) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at System.Text.RegularExpressions.Regex.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Expander`2.MetadataExpander.ExpandMetadataLeaveEscaped(String expression, IMetadataTable metadata, ExpanderOptions options, IElementLocation elementLocation) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Expander`2.ExpandIntoStringLeaveEscaped(String expression, ExpanderOptions options, IElementLocation elementLocation, LoggingContext loggingContext) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.EvaluateItemDefinitionElement(ProjectItemDefinitionElement itemDefinitionElement) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.EvaluateItemDefinitionGroupElement(ProjectItemDefinitionGroupElement itemDefinitionGroupElement) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.Evaluate() [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Execution.ProjectInstance.Initialize(ProjectRootElement xml, IDictionary`2 globalProperties, String explicitToolsVersion, String explicitSubToolsetVersion, Int32 visualStudioVersionFromSolution, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, Nullable`1 projectLoadSettings, EvaluationContext evaluationContext) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Execution.ProjectInstance..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, Nullable`1 projectLoadSettings) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.BackEnd.BuildRequestConfiguration.<>c__DisplayClass60_0.<LoadProjectIntoConfiguration>b__0() [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.BackEnd.BuildRequestConfiguration.InitializeProject(BuildParameters buildParameters, Func`1 loadProjectFromFile) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.BackEnd.RequestBuilder.BuildProject() [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.BackEnd.RequestBuilder.BuildAndReport() [/src/testspa/testspa.csproj]
------

Debian

If you try to do the same but with the base image with tag 7.0-bullseye-slim-arm64v8 which is based on Debian, the dotnet restore command also fails with:

------
 > [build  9/12] RUN dotnet restore "testspa/testspa.csproj":
dotnet/msbuild#22 17.28 /usr/share/dotnet/sdk/7.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(55,5): error MSB4184: The expression "[MSBuild]::GetTargetFrameworkVersion(net7.0, 2)" cannot be evaluated. Exception has been thrown by the target of an invocation. [/src/testspa/testspa.csproj]
------

.NET 7 on Linux amd64

Everything works well if I use the base images with the tag "7.0" which is targeted amd64. So, it is an ARM issue.

.NET 6 on ARM

If you run the same on .NET6 everything works perfectly with Ubuntu and Debian base images for ARM64v8.

@rainersigwald
Copy link
Member

@anmalkov is the host machine you're running on ARM64, or are you using Docker's built in qemu ARM64 emulation?

The expression "[MSBuild]::GetTargetFrameworkVersion(net7.0, 2)" cannot be evaluated. Exception has been thrown by the target of an invocation.

This one is tracked by NuGet/Home#12227.

@rainersigwald
Copy link
Member

I don't see anything in the MSBuild-layer calls to RegularExpression.Replace that look fishy (or have been touched in a couple years)

https://github.com/dotnet/msbuild/blob/d14b74d6f08ab7f2e17706359a38f8c22b569cb5/src/Build/Evaluation/Expander.cs#L901-L957

So I'm going to rename + reroute this to the regex folks in dotnet/runtime.

@rainersigwald rainersigwald changed the title Unhandled error while building .NET 7 ASP.NET Core with React.js app on ARM64v8 NRE in System.Text.RegularExpresssions on ARM64 Nov 14, 2022
@rainersigwald rainersigwald transferred this issue from dotnet/msbuild Nov 14, 2022
@dotnet-issue-labeler
Copy link

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.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 14, 2022
@ghost
Copy link

ghost commented Nov 15, 2022

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

Issue Details

Steps to reproduce

  1. Create a new app in VS from template "ASP.NET Core with React.js"
  2. Name a project and solution as "testspa"
  3. Select .NET 7
  4. Create Dockerfile in the solution file directory:
FROM mcr.microsoft.com/dotnet/aspnet:7.0-jammy-arm64v8 AS base
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y libpng-dev libjpeg-dev curl libxi6 build-essential libgl1-mesa-glx
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get install -y nodejs
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0-jammy-arm64v8 AS build
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y libpng-dev libjpeg-dev curl libxi6 build-essential libgl1-mesa-glx
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get install -y nodejs
WORKDIR /src
COPY ["testspa/testspa.csproj", "testspa/"]
RUN dotnet restore "testspa/testspa.csproj"
COPY . .
WORKDIR "/src/testspa"
RUN dotnet build "testspa.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "testspa.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "testspa.dll"]
  1. Open terminal and go to solution directory
  2. Build an image:
docker build -t testspa .

Expected result:

A solution should be built and container image should be created

Actual result:

dotnet restore command fails with:

------
 > [build  9/12] RUN dotnet restore "testspa/testspa.csproj":
dotnet/msbuild#21 15.85 MSBUILD : error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled. [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :     System.NullReferenceException: Object reference not set to an instance of an object. [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Regex1_Scan(RegexRunner, ReadOnlySpan`1) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at System.Text.RegularExpressions.Regex.ScanInternal(RegexRunnerMode mode, Boolean reuseMatchObject, String input, Int32 beginning, RegexRunner runner, ReadOnlySpan`1 span, Boolean returnNullIfReuseMatchObject) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at System.Text.RegularExpressions.Regex.RunAllMatchesWithCallback[TState](String inputString, ReadOnlySpan`1 inputSpan, Int32 startat, TState& state, MatchCallback`1 callback, RegexRunnerMode mode, Boolean reuseMatchObject) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at System.Text.RegularExpressions.Regex.RunAllMatchesWithCallback[TState](String input, Int32 startat, TState& state, MatchCallback`1 callback, RegexRunnerMode mode, Boolean reuseMatchObject) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at System.Text.RegularExpressions.Regex.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Expander`2.MetadataExpander.ExpandMetadataLeaveEscaped(String expression, IMetadataTable metadata, ExpanderOptions options, IElementLocation elementLocation) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Expander`2.ExpandIntoStringLeaveEscaped(String expression, ExpanderOptions options, IElementLocation elementLocation, LoggingContext loggingContext) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.EvaluateItemDefinitionElement(ProjectItemDefinitionElement itemDefinitionElement) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.EvaluateItemDefinitionGroupElement(ProjectItemDefinitionGroupElement itemDefinitionGroupElement) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.Evaluate() [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Execution.ProjectInstance.Initialize(ProjectRootElement xml, IDictionary`2 globalProperties, String explicitToolsVersion, String explicitSubToolsetVersion, Int32 visualStudioVersionFromSolution, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, Nullable`1 projectLoadSettings, EvaluationContext evaluationContext) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.Execution.ProjectInstance..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, Nullable`1 projectLoadSettings) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.BackEnd.BuildRequestConfiguration.<>c__DisplayClass60_0.<LoadProjectIntoConfiguration>b__0() [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.BackEnd.BuildRequestConfiguration.InitializeProject(BuildParameters buildParameters, Func`1 loadProjectFromFile) [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.BackEnd.RequestBuilder.BuildProject() [/src/testspa/testspa.csproj]
dotnet/msbuild#21 15.85 MSBUILD : error :    at Microsoft.Build.BackEnd.RequestBuilder.BuildAndReport() [/src/testspa/testspa.csproj]
------

Debian

If you try to do the same but with the base image with tag 7.0-bullseye-slim-arm64v8 which is based on Debian, the dotnet restore command also fails with:

------
 > [build  9/12] RUN dotnet restore "testspa/testspa.csproj":
dotnet/msbuild#22 17.28 /usr/share/dotnet/sdk/7.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(55,5): error MSB4184: The expression "[MSBuild]::GetTargetFrameworkVersion(net7.0, 2)" cannot be evaluated. Exception has been thrown by the target of an invocation. [/src/testspa/testspa.csproj]
------

.NET 7 on Linux amd64

Everything works well if I use the base images with the tag "7.0" which is targeted amd64. So, it is an ARM issue.

.NET 6 on ARM

If you run the same on .NET6 everything works perfectly with Ubuntu and Debian base images for ARM64v8.

Author: anmalkov
Assignees: -
Labels:

area-System.Text.RegularExpressions, untriaged

Milestone: -

@buyaa-n buyaa-n added this to the 8.0.0 milestone Nov 16, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Nov 16, 2022
@anmalkov
Copy link
Author

anmalkov commented Nov 17, 2022

@anmalkov is the host machine you're running on ARM64, or are you using Docker's built in qemu ARM64 emulation?

I'm building the image on Windows 11, so, on emulation. However, I want to run the container on ARM64

@omanikhi
Copy link

So 7.x will not be usable on arm64 devices and we need to wait for 8.0?!

@stephentoub
Copy link
Member

stephentoub commented Apr 12, 2023

We run a bazillion regex tests on ARM64, and to my knowledge we've never seen such an NRE. It's far from "not usable".

Do you have a standalone repro with just regex that shows the problem you're hitting?

@omanikhi
Copy link

We run a bazillion regex tests on ARM64, and to my knowledge we've never seen such an NRE. It's far from "not usable".

Do you have a standalone repro with just regex that shows the problem you're hitting?

You're absolutely right about it being far from "not usable", perhaps I was a bit overdramatic in my choice of words.

It actually doesn't happen directly on ARM64 but rather under QEMU emulation of ARM64 (on Ubuntu over x64 in our case) which should be a common production build practice building the project on a non-ARM64 CI server.

I don't have a standalone example that reproduces it but I can certainly try to get one together if it helps.

@stephentoub
Copy link
Member

Thanks.

@richlander, @AndyAyersMS, do we support / test QEMU emulation of ARM64 on .NET 7?

I'm struggling at the moment to see how this could be an issue specific to regex.

@AndyAyersMS
Copy link
Member

AndyAyersMS commented Apr 12, 2023

I don't believe running under QEMU is officially supported, but it would be nice if it worked. My guess is that this indicates a problem in QEMU.

IIRC there is some kind of verbose mode where QEMU can give you more details when it hits something it does not expect. @RobertHenry6bev ran into something like this (though he was emulating x64, not arm64) -- maybe he can suggest how to diagnose these cases.

@moo-the-cow
Copy link

moo-the-cow commented Jun 5, 2023

same issue:
on WSL2 (ubuntu jammy x86_x64)
when I run docker buildx bake -f docker-compose.yaml
edit: for testing reason I also tried docker buildx build -t test --platform linux/arm64 . same result
for ARM64 build
used image: mcr.microsoft.com/dotnet/sdk:7.0-jammy-arm64v8

[build 5/6] RUN dotnet restore:
#0 7.385 MSBUILD : error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled. [/app/aspnetapp/proj.csproj]
#0 7.385 MSBUILD : error :     System.NullReferenceException: Object reference not set to an instance of an object. [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Regex1_Scan(RegexRunner, ReadOnlySpan`1) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at System.Text.RegularExpressions.Regex.ScanInternal(RegexRunnerMode mode, Boolean reuseMatchObject, String input, Int32 beginning, RegexRunner runner, ReadOnlySpan`1 span, Boolean returnNullIfReuseMatchObject) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at System.Text.RegularExpressions.Regex.RunAllMatchesWithCallback[TState](String inputString, ReadOnlySpan`1 inputSpan, Int32 startat, TState& state, MatchCallback`1 callback, RegexRunnerMode mode, Boolean reuseMatchObject) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at System.Text.RegularExpressions.Regex.RunAllMatchesWithCallback[TState](String input, Int32 startat, TState& state, MatchCallback`1 callback, RegexRunnerMode mode, Boolean reuseMatchObject) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at System.Text.RegularExpressions.Regex.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.Evaluation.Expander`2.MetadataExpander.ExpandMetadataLeaveEscaped(String expression, IMetadataTable metadata, ExpanderOptions options, IElementLocation elementLocation) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.Evaluation.Expander`2.ExpandIntoStringLeaveEscaped(String expression, ExpanderOptions options, IElementLocation elementLocation, LoggingContext loggingContext) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.EvaluateItemDefinitionElement(ProjectItemDefinitionElement itemDefinitionElement) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.EvaluateItemDefinitionGroupElement(ProjectItemDefinitionGroupElement itemDefinitionGroupElement) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.Evaluate() [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.Execution.ProjectInstance.Initialize(ProjectRootElement xml, IDictionary`2 globalProperties, String explicitToolsVersion, String explicitSubToolsetVersion, Int32 visualStudioVersionFromSolution, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, Nullable`1 projectLoadSettings, EvaluationContext evaluationContext) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.Execution.ProjectInstance..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, Nullable`1 projectLoadSettings) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.BackEnd.BuildRequestConfiguration.<>c__DisplayClass61_0.<LoadProjectIntoConfiguration>b__0() [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.BackEnd.BuildRequestConfiguration.InitializeProject(BuildParameters buildParameters, Func`1 loadProjectFromFile) [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.BackEnd.RequestBuilder.BuildProject() [/app/aspnetapp/proj.csproj]
#0 7.386 MSBUILD : error :    at Microsoft.Build.BackEnd.RequestBuilder.BuildAndReport() [/app/aspnetapp/proj.csproj]

@mhoeper
Copy link

mhoeper commented Jun 7, 2023

We are facing the same issue, too on Amazon Linux x86_x64

@danmoseley
Copy link
Member

So neither of you are using QEMU?

@mhoeper
Copy link

mhoeper commented Jun 7, 2023

Correct. The NullReferenceException happens as well locally, when I am building with Docker Desktop on Windows on my x86_x64 machine, using --platform linux/arm64 with FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build

@stephentoub
Copy link
Member

So neither of you are using QEMU?

on my x86_x64 machine, using --platform linux/arm64

Targeting arm64 while running on x86/x64 hardware requires emulation. Is this ever happening without emulation?

@mhoeper
Copy link

mhoeper commented Jun 7, 2023

Looks like this issue is reproducible as reported from multiple persons and a Nullreference Exception in Regex1_Scan. This is a programming mistake in Msbuild as null check missing and should be easy to fix, right?

@stephentoub
Copy link
Member

Looks like this issue is reproducible as reported from multiple persons

All confirmed cases are using emulated arm64

This is a programming mistake in Msbuild as null check missing and should be easy to fix, right?

No.

@danmoseley
Copy link
Member

@RobertHenry6bev do you have any suggestions folks can try to gather more info here, per suggestion above?

@danmoseley
Copy link
Member

@jkotas what is the support status of .NET in QEMU -- and if not supported, how well is it known to work?

@jkotas
Copy link
Member

jkotas commented Jun 7, 2023

Not supported. Documented here: https://github.com/dotnet/core/blob/main/release-notes/7.0/supported-os.md#qemu

It is known to be unusable for anything real.

@danmoseley
Copy link
Member

OK, I'm going to close this as it's a QEMU issue. If anyone is encountering this but not in fact emulating arm64 please open a new issue.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests