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

Enabling AOT on a project referencing Microsoft.Azure.Cosmos.Table fails compilation #62089

Closed
cdomino opened this issue Nov 26, 2021 · 3 comments
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono

Comments

@cdomino
Copy link

cdomino commented Nov 26, 2021

Describe the bug

When upgrading an existing .NET 5 Blazor WASM app (ASP.NET Core hosted) to .NET 6 proper (i.e. not a preview version), AOT compilation fails when Microsoft.Azure.Cosmos.Table is referenced.

To Reproduce

  1. Open an elevated command prompt.
  2. Run dotnet new blazorWasm
  3. Pop into Visual Studio, open the newly-created project, and enable some AOT goodness in the .csproj file: <RunAOTCompilation>true</RunAOTCompilation>
  4. Save, return to CMD, run dotnet publish -c Release, and note that it works fine.
  5. Back in Visual Studio, add the Microsoft.Azure.Cosmos.Table (v1.0.8) Nuget package and save.
  6. Finally back in CMD, run dotnet publish -c Release again.
  7. Get the following error:

[Microsoft.Azure.DocumentDB.Core.dll] Exec (with response file contents expanded) in C:\ [omitted] \obj\Release\net6.0\linked: MONO_PATH=C:\ [omitted] \obj\Release\net6.0\linked;C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\6.0.0\runtimes\browser-wasm\native;C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\6.0.0\runtimes\browser-wasm\lib\net6.0 MONO_ENV_OPTIONS= C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm\6.0.0\Sdk..\tools\mono-aot-cross.exe --debug --llvm "--aot=no-opt,static,direct-icalls,deterministic,dwarfdebug,llvm-path=C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.23.Sdk.win-x64\6.0.0\tools\bin,static,llvmonly,interp,asmonly,llvm-outfile=C:\ [omitted] \obj\Release\net6.0\wasm\for-publish\Microsoft.Azure.DocumentDB.Core.dll.bc.tmp" "Microsoft.Azure.DocumentDB.Core.dll"

C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\6.0.0\Sdk\WasmApp.Native.targets(506,5): error : Precompiling failed for C:\ [omitted] \obj\Release\net6.0\linked\Microsoft.Azure.DocumentDB.Core.dll [C:\ [omitted] .csproj]

Note

In case this helps anyone, I did find a soul-crushing workaround: revert to the old skool, long-since-deprecated WindowsAzure.Storage (v9.3.3) Nuget package...and it works with .NET 6 Blazor WASM AOT! I'm not actually calling into my Azure repositories from the client; however, I'm stuck with some entities in a shared library that inherit from TableEntity which are referenced both in Blazor and on the server.

Additional Question

When WindowsAzure.Storage was deprecated, I found it a bit awkward that blobs, queues, and files all got their own Nuget packages (that actaully AOT just fine in my project), but it seems like the table storage API got itself mixed up with Cosmos DB. Is there a better package that plays nicely with AOT? I looked at Azure.Data.Tables but that won't work for me because in has TableEntity sealed and therefore my entities can't inherit from it...and my CEO won't pay me to refactor this any further. 😉

Thanks so much!

Further technical details

  • ASP.NET Core version: .NET 6
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version: Visual Studio 2022 on Windows 11
  • Include the output of dotnet --info:
dotnet --info Output .NET SDK (reflecting any global.json): Version: 6.0.100 Commit: 9e8b04bbff

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

Host (useful for support):
Version: 6.0.0
Commit: 4822e3c

.NET SDKs installed:
3.1.401 [C:\Program Files\dotnet\sdk]
3.1.402 [C:\Program Files\dotnet\sdk]
3.1.415 [C:\Program Files\dotnet\sdk]
5.0.104 [C:\Program Files\dotnet\sdk]
5.0.202 [C:\Program Files\dotnet\sdk]
5.0.203 [C:\Program Files\dotnet\sdk]
5.0.209 [C:\Program Files\dotnet\sdk]
5.0.303 [C:\Program Files\dotnet\sdk]
5.0.402 [C:\Program Files\dotnet\sdk]
5.0.403 [C:\Program Files\dotnet\sdk]
6.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@pranavkm pranavkm transferred this issue from dotnet/aspnetcore Nov 26, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Nov 26, 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.

@pranavkm pranavkm added arch-wasm WebAssembly architecture and removed untriaged New issue has not been triaged by the area owner labels Nov 26, 2021
@ghost
Copy link

ghost commented Nov 26, 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 upgrading an existing .NET 5 Blazor WASM app (ASP.NET Core hosted) to .NET 6 proper (i.e. not a preview version), AOT compilation fails when Microsoft.Azure.Cosmos.Table is referenced.

To Reproduce

  1. Open an elevated command prompt.
  2. Run dotnet new blazorWasm
  3. Pop into Visual Studio, open the newly-created project, and enable some AOT goodness in the .csproj file: <RunAOTCompilation>true</RunAOTCompilation>
  4. Save, return to CMD, run dotnet publish -c Release, and note that it works fine.
  5. Back in Visual Studio, add the Microsoft.Azure.Cosmos.Table (v1.0.8) Nuget package and save.
  6. Finally back in CMD, run dotnet publish -c Release again.
  7. Get the following error:

[Microsoft.Azure.DocumentDB.Core.dll] Exec (with response file contents expanded) in C:\ [omitted] \obj\Release\net6.0\linked: MONO_PATH=C:\ [omitted] \obj\Release\net6.0\linked;C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\6.0.0\runtimes\browser-wasm\native;C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\6.0.0\runtimes\browser-wasm\lib\net6.0 MONO_ENV_OPTIONS= C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm\6.0.0\Sdk..\tools\mono-aot-cross.exe --debug --llvm "--aot=no-opt,static,direct-icalls,deterministic,dwarfdebug,llvm-path=C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.23.Sdk.win-x64\6.0.0\tools\bin,static,llvmonly,interp,asmonly,llvm-outfile=C:\ [omitted] \obj\Release\net6.0\wasm\for-publish\Microsoft.Azure.DocumentDB.Core.dll.bc.tmp" "Microsoft.Azure.DocumentDB.Core.dll"

C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\6.0.0\Sdk\WasmApp.Native.targets(506,5): error : Precompiling failed for C:\ [omitted] \obj\Release\net6.0\linked\Microsoft.Azure.DocumentDB.Core.dll [C:\ [omitted] .csproj]

Note

In case this helps anyone, I did find a soul-crushing workaround: revert to the old skool, long-since-deprecated WindowsAzure.Storage (v9.3.3) Nuget package...and it works with .NET 6 Blazor WASM AOT! I'm not actually calling into my Azure repositories from the client; however, I'm stuck with some entities in a shared library that inherit from TableEntity which are referenced both in Blazor and on the server.

Additional Question

When WindowsAzure.Storage was deprecated, I found it a bit awkward that blobs, queues, and files all got their own Nuget packages (that actaully AOT just fine in my project), but it seems like the table storage API got itself mixed up with Cosmos DB. Is there a better package that plays nicely with AOT? I looked at Azure.Data.Tables but that won't work for me because in has TableEntity sealed and therefore my entities can't inherit from it...and my CEO won't pay me to refactor this any further. 😉

Thanks so much!

Further technical details

  • ASP.NET Core version: .NET 6
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version: Visual Studio 2022 on Windows 11
  • Include the output of dotnet --info:
dotnet --info Output .NET SDK (reflecting any global.json): Version: 6.0.100 Commit: 9e8b04bbff

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

Host (useful for support):
Version: 6.0.0
Commit: 4822e3c

.NET SDKs installed:
3.1.401 [C:\Program Files\dotnet\sdk]
3.1.402 [C:\Program Files\dotnet\sdk]
3.1.415 [C:\Program Files\dotnet\sdk]
5.0.104 [C:\Program Files\dotnet\sdk]
5.0.202 [C:\Program Files\dotnet\sdk]
5.0.203 [C:\Program Files\dotnet\sdk]
5.0.209 [C:\Program Files\dotnet\sdk]
5.0.303 [C:\Program Files\dotnet\sdk]
5.0.402 [C:\Program Files\dotnet\sdk]
5.0.403 [C:\Program Files\dotnet\sdk]
6.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Author: cdomino
Assignees: -
Labels:

arch-wasm

Milestone: -

@radical
Copy link
Member

radical commented Nov 29, 2021

Log has: [Microsoft.Azure.DocumentDB.Core.dll] Exit code: -1073741571 returned from mono-aot-cross.exe. This was fixed in #60265 but didn't make it in the 6.0 GA release.

You can wait for the servicing release, or try the latest 7.0.0-alpha* from https://github.com/dotnet/installer#installers-and-binaries .

Closing as a dupe of #61053 .

@radical radical closed this as completed Nov 29, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Dec 30, 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

4 participants