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

Blazor AOT compilation fails on Emscripten target when run in containers #54342

Closed
timheuer opened this issue Jun 17, 2021 · 26 comments
Closed
Assignees
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono
Milestone

Comments

@timheuer
Copy link
Member

Describe the bug

When trying to build a Blazor Wasm client project in a container, the AOT step fails on an emcc exit code. These same steps work fine in a CI pipeline (GitHub Actions)

To Reproduce

Repo: https://github.com/timheuer/PictureFixer/ (docker branch)
Dockerfile: https://github.com/timheuer/PictureFixer/blob/docker/PictureFixer/Dockerfile

Ensure Docker Desktop installed
run docker build . from within the PictureFixer/PictureFixer location

Exceptions (if any)

All steps succeed until the dotnet publish phase which emits:

 => ERROR [publish 1/1] RUN dotnet publish "PictureFixer.Server.csproj" -c Release -o /app/publish                36.4s
------
 > [publish 1/1] RUN dotnet publish "PictureFixer.Server.csproj" -c Release -o /app/publish:
dotnet/aspnetcore#20 0.297 Microsoft (R) Build Engine version 17.0.0-preview-21302-02+018bed83d for .NET
dotnet/aspnetcore#20 0.297 Copyright (C) Microsoft Corporation. All rights reserved.
dotnet/aspnetcore#20 0.297
dotnet/aspnetcore#20 0.604   Determining projects to restore...
dotnet/aspnetcore#20 1.096   All projects are up-to-date for restore.
dotnet/aspnetcore#20 1.147   You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
dotnet/aspnetcore#20 1.295   You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
dotnet/aspnetcore#20 1.437   PictureFixer.Shared -> /src/Shared/bin/Release/net6.0/PictureFixer.Shared.dll
dotnet/aspnetcore#20 2.994   PictureFixer.Client -> /src/Client/bin/Release/net6.0/PictureFixer.Client.dll
dotnet/aspnetcore#20 2.995   PictureFixer.Client (Blazor output) -> /src/Client/bin/Release/net6.0/wwwroot
dotnet/aspnetcore#20 5.240   PictureFixer.Server -> /src/Server/bin/Release/net6.0/PictureFixer.Server.dll
dotnet/aspnetcore#20 8.440   Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
dotnet/aspnetcore#20 8.452   AOT'ing 56 assemblies
dotnet/aspnetcore#20 36.17 /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.5.21301.5/Sdk/WasmApp.targets(507,5): error MSB3073: The command "emcc --version" exited with code 1. [/src/Client/PictureFixer.Client.csproj]
------
executor failed running [/bin/sh -c dotnet publish "PictureFixer.Server.csproj" -c Release -o /app/publish]: exit code: 1

Further technical details

.NET SDK (reflecting any global.json):
 Version:   6.0.100-preview.5.21302.13
 Commit:    d6380bcae7

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100-preview.5.21302.13\

Host (useful for support):
  Version: 6.0.0-preview.5.21301.5
  Commit:  ec3e0b276b
@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/aspnetcore Jun 17, 2021
@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.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jun 17, 2021
@marek-safar marek-safar added the arch-wasm WebAssembly architecture label Jun 17, 2021
@ghost
Copy link

ghost commented Jun 17, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Describe the bug

When trying to build a Blazor Wasm client project in a container, the AOT step fails on an emcc exit code. These same steps work fine in a CI pipeline (GitHub Actions)

To Reproduce

Repo: https://github.com/timheuer/PictureFixer/ (docker branch)
Dockerfile: https://github.com/timheuer/PictureFixer/blob/docker/PictureFixer/Dockerfile

Ensure Docker Desktop installed
run docker build . from within the PictureFixer/PictureFixer location

Exceptions (if any)

All steps succeed until the dotnet publish phase which emits:

 => ERROR [publish 1/1] RUN dotnet publish "PictureFixer.Server.csproj" -c Release -o /app/publish                36.4s
------
 > [publish 1/1] RUN dotnet publish "PictureFixer.Server.csproj" -c Release -o /app/publish:
dotnet/aspnetcore#20 0.297 Microsoft (R) Build Engine version 17.0.0-preview-21302-02+018bed83d for .NET
dotnet/aspnetcore#20 0.297 Copyright (C) Microsoft Corporation. All rights reserved.
dotnet/aspnetcore#20 0.297
dotnet/aspnetcore#20 0.604   Determining projects to restore...
dotnet/aspnetcore#20 1.096   All projects are up-to-date for restore.
dotnet/aspnetcore#20 1.147   You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
dotnet/aspnetcore#20 1.295   You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
dotnet/aspnetcore#20 1.437   PictureFixer.Shared -> /src/Shared/bin/Release/net6.0/PictureFixer.Shared.dll
dotnet/aspnetcore#20 2.994   PictureFixer.Client -> /src/Client/bin/Release/net6.0/PictureFixer.Client.dll
dotnet/aspnetcore#20 2.995   PictureFixer.Client (Blazor output) -> /src/Client/bin/Release/net6.0/wwwroot
dotnet/aspnetcore#20 5.240   PictureFixer.Server -> /src/Server/bin/Release/net6.0/PictureFixer.Server.dll
dotnet/aspnetcore#20 8.440   Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
dotnet/aspnetcore#20 8.452   AOT'ing 56 assemblies
dotnet/aspnetcore#20 36.17 /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.5.21301.5/Sdk/WasmApp.targets(507,5): error MSB3073: The command "emcc --version" exited with code 1. [/src/Client/PictureFixer.Client.csproj]
------
executor failed running [/bin/sh -c dotnet publish "PictureFixer.Server.csproj" -c Release -o /app/publish]: exit code: 1

Further technical details

.NET SDK (reflecting any global.json):
 Version:   6.0.100-preview.5.21302.13
 Commit:    d6380bcae7

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100-preview.5.21302.13\

Host (useful for support):
  Version: 6.0.0-preview.5.21301.5
  Commit:  ec3e0b276b
Author: timheuer
Assignees: -
Labels:

arch-wasm, area-Codegen-AOT-mono, untriaged

Milestone: -

@lewing lewing added this to the 6.0.0 milestone Jun 17, 2021
@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Jun 17, 2021
@timheuer
Copy link
Member Author

Now that Preview 5 is public, removing the nightly SDK and using this docker file:

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
#FROM mcr.microsoft.com/dotnet/nightly/sdk:6.0 AS build 
#COPY ["nuget.config", "nuget.config"]
RUN dotnet workload install microsoft-net-sdk-blazorwebassembly-aot
WORKDIR /src
COPY ["Server/PictureFixer.Server.csproj", "Server/"]
COPY ["Shared/PictureFixer.Shared.csproj", "Shared/"]
COPY ["Client/PictureFixer.Client.csproj", "Client/"]
RUN dotnet restore "Server/PictureFixer.Server.csproj"
COPY . .
WORKDIR "/src/Server"
RUN dotnet build "PictureFixer.Server.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "PictureFixer.Server.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PictureFixer.Server.dll"]

I get a different error:

 > [build  2/10] RUN dotnet workload install microsoft-net-sdk-blazorwebassembly-aot:
#9 0.329
#9 1.776 Updated advertising manifest microsoft.net.sdk.tvos.
#9 2.404 Updated advertising manifest microsoft.net.sdk.android.
#9 3.025 Updated advertising manifest microsoft.net.sdk.ios.
#9 3.668 Updated advertising manifest microsoft.net.sdk.macos.
#9 4.160 Updated advertising manifest microsoft.net.sdk.maccatalyst.
#9 4.655 Updated advertising manifest microsoft.net.workload.mono.toolchain.
#9 4.659 Installing workload manifest microsoft.net.sdk.tvos version 14.5.100-preview.5.894.
#9 4.999 Workload installation failed, rolling back installed packs...
#9 4.999 Installing workload manifest microsoft.net.sdk.tvos version 14.5.100-preview.5.881.
#9 4.999 Installation roll back failed: Failed to install manifest microsoft.net.sdk.tvos version 14.5.100-preview.5.881: The transaction has aborted..
#9 5.000 Workload installation failed: Failed to install manifest microsoft.net.sdk.tvos version 14.5.100-preview.5.894: Invalid cross-device link.

@radical
Copy link
Member

radical commented Jun 22, 2021

note to self: I hit this Invalid cross-device link on CI too with my PR, and it was failing while trying to move the directories. Copying instead, works better.

@lewing
Copy link
Member

lewing commented Jun 22, 2021

I get a different error:

 > [build  2/10] RUN dotnet workload install microsoft-net-sdk-blazorwebassembly-aot:
#9 0.329
#9 1.776 Updated advertising manifest microsoft.net.sdk.tvos.
#9 2.404 Updated advertising manifest microsoft.net.sdk.android.
#9 3.025 Updated advertising manifest microsoft.net.sdk.ios.
#9 3.668 Updated advertising manifest microsoft.net.sdk.macos.
#9 4.160 Updated advertising manifest microsoft.net.sdk.maccatalyst.
#9 4.655 Updated advertising manifest microsoft.net.workload.mono.toolchain.
#9 4.659 Installing workload manifest microsoft.net.sdk.tvos version 14.5.100-preview.5.894.
#9 4.999 Workload installation failed, rolling back installed packs...
#9 4.999 Installing workload manifest microsoft.net.sdk.tvos version 14.5.100-preview.5.881.
#9 4.999 Installation roll back failed: Failed to install manifest microsoft.net.sdk.tvos version 14.5.100-preview.5.881: The transaction has aborted..
#9 5.000 Workload installation failed: Failed to install manifest microsoft.net.sdk.tvos version 14.5.100-preview.5.894: Invalid cross-device link.

Just to be clear this is the SDK failing to update the workload manifest for microsoft.net.sdk.tvos and then failing to roll back as well it has nothing to to with wasm

#9 4.655 Updated advertising manifest microsoft.net.workload.mono.toolchain.

means it updated the wasm aot workload manifest correctly then it failed updating the the next manifest.

@timheuer
Copy link
Member Author

Just to be clear this is the SDK failing to update the workload manifest for microsoft.net.sdk.tvos and then failing to roll back as well it has nothing to to with wasm

Cool, seems like that one is known...the original fail on Emscripten is the bigger concern here.

@sfoslund
Copy link
Member

After email discussion, I've filed a new SDK issue for the workload installation failure we're seeing here: dotnet/sdk#18450

@lewing
Copy link
Member

lewing commented Jun 23, 2021

Just to be clear this is the SDK failing to update the workload manifest for microsoft.net.sdk.tvos and then failing to roll back as well it has nothing to to with wasm

Cool, seems like that one is known...the original fail on Emscripten is the bigger concern here.

I'm fairly sure the emscripten failure there was a preview4 linux problem that we fixed. Unfortunately testing that is difficult because nightlies of the SDK are even more broken with workloads

dotnet workload install microsoft-net-sdk-blazorwebassembly-aot

Skip NuGet package signing validation. NuGet signing validation is not available on Linux or macOS https://aka.ms/workloadskippackagevalidation .
Failed to update the advertising manifest microsoft.net.workload.mono.toolchain: Invalid cross-device link.
Failed to update the advertising manifest microsoft.net.sdk.macos: Invalid cross-device link.
Failed to update the advertising manifest microsoft.net.sdk.maccatalyst: Invalid cross-device link.
Failed to update the advertising manifest microsoft.net.sdk.maui: Invalid cross-device link.
Failed to update the advertising manifest microsoft.net.sdk.ios: Invalid cross-device link.
Failed to update the advertising manifest microsoft.net.sdk.android: Invalid cross-device link.
Failed to update the advertising manifest microsoft.net.sdk.tvos: Invalid cross-device link.
Installing pack Microsoft.NET.Runtime.WebAssembly.Sdk version 6.0.0-preview.7.21321.15...
Workload installation failed, rolling back installed packs...
Rolling back pack Microsoft.NET.Runtime.WebAssembly.Sdk installation...
Workload installation failed: Invalid cross-device link
install
  Install a workload.

Usage:
  dotnet [options] workload install [<WORKLOAD_ID>...]

Arguments:
  <WORKLOAD_ID>  The NuGet Package Id of the workload to install.

Options:
  --sdk-version <VERSION>                                                  The version of the SDK.
  --configfile <FILE>                                                      The NuGet configuration file to use.
  --add-source <SOURCE>                                                    Add an additional NuGet package source to use during installation.
  --skip-manifest-update                                                   Skip updating the workload manifests.
  --from-cache <from-cache>                                                Complete the operation from cache (offline).
  --download-to-cache <download-to-cache>                                  Download packages needed to install a workload to a folder which can be used for offline installation.
  --include-previews                                                       Allow prerelease workload manifests.
  --temp-dir <temp-dir>                                                    Configure the temporary directory used for this command (must be secure).
  --disable-parallel                                                       Prevent restoring multiple projects in parallel.
  --ignore-failed-sources                                                  Treat package source failures as warnings.
  --no-cache                                                               Do not cache packages and http requests.
  --interactive                                                            Allows the command to stop and wait for user input or action (for example to complete authentication).
  -v, --verbosity <d|detailed|diag|diagnostic|m|minimal|n|normal|q|quiet>  Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
  -?, -h, --help                                                           Show help and usage information

@timheuer
Copy link
Member Author

@lewing if you add --skip-manifest-update at the end of that workload command it will clear that particular error. On the note about broken with linux though, just again pointing out that on a CI build (ubuntu container effectively) this worked fine...it's using our own SDK image + Docker that is failing. I don't know if there is any material distinction but I just simply can't debug enough to figure out how to be more helpful in what I'm seeing. Happy to flip whatever logs, etc. you think can be more helpful

@lewing
Copy link
Member

lewing commented Jun 23, 2021

@timheuer yeah the cross-link failure is that the manifest update is trying to move across mounts rather than copy+remove it shouldn't be difficult to solve now that it is identified. The larger issue is that there are are many moving pieces around workloads that are under active development and something going wrong at almost any step can break things in hard to understand ways.

@timheuer
Copy link
Member Author

@lewing is there anything I can provide more for this emscripten one here? this doesn't feel like a workload one, but rather a fail on a target based on me looking. Happy to provide verbose logs and such, but it feels clear where it is failing...just not sure how to determine the why.

@lewing
Copy link
Member

lewing commented Jun 23, 2021

@timheuer I'm fairly sure the problem is that your container doesn't contain python and we don't include python on linux. We can add a descriptive error in this case. If you want to upload the binlog we can double check.

@timheuer
Copy link
Member Author

Interesting @lewing! How is this working locally for me on Windows when I don't have Python either? Modifying the Dockerfile to add:

RUN apt-get update
RUN apt-get install --no-install-recommends --yes python3
RUN dotnet workload install microsoft-net-sdk-blazorwebassembly-aot --skip-manifest-update

Gets me past the emcc exit code so your hunch feels right, and now I'm faced with:

 > [publish 1/1] RUN dotnet publish "PictureFixer.Server.csproj" -c Release -o /app/publish --nologo:
#22 0.820   Determining projects to restore...
#22 1.303   All projects are up-to-date for restore.
#22 1.355   You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
#22 1.498   You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
#22 1.642   PictureFixer.Shared -> /src/Shared/bin/Release/net6.0/PictureFixer.Shared.dll
#22 3.428   PictureFixer.Client -> /src/Client/bin/Release/net6.0/PictureFixer.Client.dll
#22 3.429   PictureFixer.Client (Blazor output) -> /src/Client/bin/Release/net6.0/wwwroot
#22 5.976   PictureFixer.Server -> /src/Server/bin/Release/net6.0/PictureFixer.Server.dll
#22 8.999   Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
#22 9.011 /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.6.21317.12/Sdk/WasmApp.Native.targets(342,5): error : Could not find AOT cross compiler at $(_MonoAotCrossCompilerPath)= [/src/Client/PictureFixer.Client.csproj]
------
executor failed running [/bin/sh -c dotnet publish "PictureFixer.Server.csproj" -c Release -o /app/publish --nologo]: exit code: 1

Is this due to the other workload issues you note?

@lewing
Copy link
Member

lewing commented Jun 23, 2021

@timheuer what was the output of RUN dotnet workload install microsoft-net-sdk-blazorwebassembly-aot --skip-manifest-update ?

@timheuer
Copy link
Member Author

@timheuer what was the output of RUN dotnet workload install microsoft-net-sdk-blazorwebassembly-aot --skip-manifest-update ?

All success, no errors...the detail log goes away from the output so I can't copy it here, but no errors and everything was installing.

@lewing
Copy link
Member

lewing commented Jun 23, 2021

Is this due to the other workload issues you note?

nope #54651

@radical
Copy link
Member

radical commented Jul 19, 2021

@timheuer Can you try with preview6?

@timheuer
Copy link
Member Author

timheuer commented Jul 19, 2021

@radical I tried with using all the public preview6 tags/images and it all works using this docker file (below all this) key points are

RUN apt-get update
RUN apt-get install --no-install-recommends --yes python3
RUN dotnet workload install microsoft-net-sdk-blazorwebassembly-aot --skip-manifest-update

without the --skip-manifest-update I still receive:

[build  4/12] RUN dotnet workload install microsoft-net-sdk-blazorwebassembly-aot:
#11 0.334
#11 1.183 Skip NuGet package signing validation. NuGet signing validation is not available on Linux or macOS https://aka.ms/workloadskippackagevalidation .
#11 1.211 Updated advertising manifest microsoft.net.sdk.tvos.
#11 1.868 Updated advertising manifest microsoft.net.sdk.android.
#11 2.507 Updated advertising manifest microsoft.net.sdk.ios.
#11 3.158 Updated advertising manifest microsoft.net.sdk.macos.
#11 3.671 Updated advertising manifest microsoft.net.sdk.maccatalyst.
#11 4.181 Updated advertising manifest microsoft.net.sdk.maui.
#11 4.689 Updated advertising manifest microsoft.net.workload.mono.toolchain.
#11 4.698 Installing workload manifest microsoft.net.sdk.tvos version 15.0.100-preview.6.63.
#11 5.033 Workload installation failed, rolling back installed packs...
#11 5.034 Installing workload manifest microsoft.net.sdk.tvos version 15.0.100-preview.6.58.
#11 5.034 Installation roll back failed: Failed to install manifest microsoft.net.sdk.tvos version 15.0.100-preview.6.58: The transaction has aborted..
#11 5.035 Workload installation failed: Failed to install manifest microsoft.net.sdk.tvos version 15.0.100-preview.6.63: Invalid cross-device link.

dockerfile:

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

#FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build 
# COPY ["nuget.config", "nuget.config"]
RUN apt-get update
RUN apt-get install --no-install-recommends --yes python3
RUN dotnet workload install microsoft-net-sdk-blazorwebassembly-aot --skip-manifest-update
WORKDIR /src
COPY ["Server/PictureFixer.Server.csproj", "Server/"]
COPY ["Shared/PictureFixer.Shared.csproj", "Shared/"]
COPY ["Client/PictureFixer.Client.csproj", "Client/"]
RUN dotnet restore "Server/PictureFixer.Server.csproj"
COPY . .
WORKDIR "/src/Server"
RUN dotnet build "PictureFixer.Server.csproj" -c Release -o /app/build --nologo

FROM build AS publish
RUN dotnet publish "PictureFixer.Server.csproj" -c Release -o /app/publish --nologo

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PictureFixer.Server.dll"]

@radical
Copy link
Member

radical commented Jul 19, 2021

Oh, looks like the fix wasn't in preview6. But is in the latest builds (rc1).

@radical
Copy link
Member

radical commented Jul 21, 2021

I tried the dockerfile, and it downloads 6.0.100-preview.7.21369.21, but blazor is broken with that right now, so I'm unable to test this.

IIUC, it's dotnet/sdk#19080, and dotnet/aspnetcore#34571

/usr/share/dotnet/sdk/6.0.100-preview.7.21369.21/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(668,7): error : System.InvalidOperationException: Unknown source type '' for '/src/Client/Pages/Editor/EditImage.razor.js'. [/src/Client/PictureFixer.Client.csproj]
/usr/share/dotnet/sdk/6.0.100-preview.7.21369.21/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(668,7): error :    at Microsoft.AspNetCore.Razor.Tasks.StaticWebAsset.Validate() in Microsoft.NET.Sdk.Razor.Tasks.dll:token 0x60001ee+0x75 [/src/Client/PictureFixer.Client.csproj]
/usr/share/dotnet/sdk/6.0.100-preview.7.21369.21/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(668,7): error :    at Microsoft.AspNetCore.Razor.Tasks.StaticWebAsset.FromTaskItem(ITaskItem item) in Microsoft.NET.Sdk.Razor.Tasks.dll:token 0x60001e8+0xd [/src/Client/PictureFixer.Client.csproj]
/usr/share/dotnet/sdk/6.0.100-preview.7.21369.21/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(668,7): error :    at Microsoft.AspNetCore.Razor.Tasks.ComputeReferencedProjectAssets.<>c.<Execute>b__20_1(ITaskItem a) in Microsoft.NET.Sdk.Razor.Tasks.dll:token 0x6000251+0x0 [/src/Client/PictureFixer.Client.csproj]
/usr/share/dotnet/sdk/6.0.100-preview.7.21369.21/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(668,7): error :    at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](TSource[] source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) in System.Linq.dll:token 0x6000122+0xe [/src/Client/PictureFixer.Client.csproj]
/usr/share/dotnet/sdk/6.0.100-preview.7.21369.21/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(668,7): error :    at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector) in System.Linq.dll:token 0x6000120+0x0 [/src/Client/PictureFixer.Client.csproj]
/usr/share/dotnet/sdk/6.0.100-preview.7.21369.21/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(668,7): error :    at Microsoft.AspNetCore.Razor.Tasks.ComputeReferencedProjectAssets.Execute() in Microsoft.NET.Sdk.Razor.Tasks.dll:token 0x600012e+0x60 [/src/Client/PictureFixer.Client.csproj]

@javiercn
Copy link
Member

Update the asset definitions as described dotnet/aspnetcore#34577

https://github.com/timheuer/PictureFixer/blob/main/PictureFixer/Client/PictureFixer.Client.csproj#L11-L13

@radical
Copy link
Member

radical commented Jul 22, 2021

Based on @javiercn's suggestion, I changed:

    <StaticWebAsset Include="@(JavaScriptModules->'%(FullPath)')"
      SourceType="Discovered" SourceId="$(PackageId)" RelativePath="%(RelativePath)"
      AssetKind="All"
      AssetMode="All"
      AssetRole="Primary"
      OriginalItemSpec="@(JavaScriptModules->'%(Identity)'))"
      BasePath="$(StaticWebAssetBasePath)" ContentRoot="$(MSBuildProjectDirectory)" />

And I tried the dockerfile, which now downloads 6.0.0-preview.7.21365.2, and builds successfully.

@timheuer Could you please confirm that this works for you now?

@timheuer
Copy link
Member Author

No still failing...this docker file:

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

#FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/nightly/sdk:6.0 AS build 
COPY ["nuget.config", "nuget.config"]
RUN apt-get update
RUN apt-get install --no-install-recommends --yes python3
RUN dotnet --info
RUN dotnet workload install microsoft-net-sdk-blazorwebassembly-aot --skip-manifest-update
WORKDIR /src
COPY ["Server/PictureFixer.Server.csproj", "Server/"]
COPY ["Shared/PictureFixer.Shared.csproj", "Shared/"]
COPY ["Client/PictureFixer.Client.csproj", "Client/"]
RUN dotnet restore "Server/PictureFixer.Server.csproj"
COPY . .
WORKDIR "/src/Server"
RUN dotnet build "PictureFixer.Server.csproj" -c Release -o /app/build --nologo

FROM build AS publish
RUN dotnet publish "PictureFixer.Server.csproj" -c Release -o /app/publish --nologo

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PictureFixer.Server.dll"]

and results in this error:

> [build  6/14] RUN dotnet workload install microsoft-net-sdk-blazorwebassembly-aot --skip-manifest-update:
#14 0.578 Workload with id microsoft-net-sdk-blazorwebassembly-aot is not recognized.

Looks like I'm hitting #55935 but I've added --skip-manifest-update and still hitting it.

@lewing
Copy link
Member

lewing commented Jul 22, 2021

the workload name changed in preview7 use 'wasm-tools' now.

@timheuer
Copy link
Member Author

Okay with that knowledge I'm able to complete this build now cleanly even without --skip-manifest-update

@radical
Copy link
Member

radical commented Jul 22, 2021

Okay with that knowledge I'm able to complete this build now cleanly even without --skip-manifest-update

Based on this, closing the issue.

@radical radical closed this as completed Jul 22, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono
Projects
None yet
Development

No branches or pull requests

7 participants