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

[wasm][aot] Blazor template AOT fails in IcalTableGenerator #51195

Closed
lewing opened this issue Apr 13, 2021 · 10 comments
Closed

[wasm][aot] Blazor template AOT fails in IcalTableGenerator #51195

lewing opened this issue Apr 13, 2021 · 10 comments
Assignees
Labels
arch-wasm WebAssembly architecture blocking Marks issues that we want to fast track in order to unblock other important work untriaged New issue has not been triaged by the area owner
Milestone

Comments

@lewing
Copy link
Member

lewing commented Apr 13, 2021

/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018: The "IcallTableGenerator" task failed unexpectedly. [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018: System.NotImplementedException: System.Threading.Thread [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at IcallTableGenerator.AppendType(StringBuilder sb, Type t) [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at IcallTableGenerator.AppendType(StringBuilder sb, Type t) [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at IcallTableGenerator.ProcessType(Type type) [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at IcallTableGenerator.GenIcallTable(String runtimeIcallTableFile, String[] assemblies) [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at IcallTableGenerator.Execute() [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/Users/lewing/Source/baot/baot.csproj]

https://github.com/dotnet/runtime/blob/main/src/tasks/WasmAppBuilder/IcallTableGenerator.cs#L175

current guess is it is from

#49637

@lewing lewing added arch-wasm WebAssembly architecture area-CoreLib-mono labels Apr 13, 2021
@lewing lewing added this to the 6.0.0 milestone Apr 13, 2021
@ghost
Copy link

ghost commented Apr 13, 2021

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

Issue Details
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018: The "IcallTableGenerator" task failed unexpectedly. [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018: System.NotImplementedException: System.Threading.Thread [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at IcallTableGenerator.AppendType(StringBuilder sb, Type t) [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at IcallTableGenerator.AppendType(StringBuilder sb, Type t) [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at IcallTableGenerator.ProcessType(Type type) [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at IcallTableGenerator.GenIcallTable(String runtimeIcallTableFile, String[] assemblies) [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at IcallTableGenerator.Execute() [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/Users/lewing/Source/baot/baot.csproj]
/usr/local/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.0-preview.4.21211.7/Sdk/WasmApp.targets(426,4): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/Users/lewing/Source/baot/baot.csproj]

https://github.com/dotnet/runtime/blob/main/src/tasks/WasmAppBuilder/IcallTableGenerator.cs#L175

current guess is it is from

#49637

Author: lewing
Assignees: vargaz, CoffeeFlux
Labels:

arch-wasm, area-CoreLib-mono

Milestone: 6.0.0

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Apr 13, 2021
@lewing
Copy link
Member Author

lewing commented Apr 13, 2021

This is blocking AOT for preview 4

cc @pranavkm

@lewing lewing added the blocking Marks issues that we want to fast track in order to unblock other important work label Apr 13, 2021
@pranavkm
Copy link
Contributor

FYI @mkArtakMSFT

@CoffeeFlux
Copy link
Contributor

The result is likely this change:

-        private static extern void InitializeCurrentThread_icall([NotNull] ref Thread? thread);
+        private static extern Thread GetCurrentThread();

I'm not clear on how this worked before though? A ref type would have hit this before:

else if (t.IsByRef)
{
AppendType (sb, t.GetElementType()!);
sb.Append ('&');
}

But then it should have tried the Thread? We also use that type in other icalls... @vargaz any ideas?

@lewing
Copy link
Member Author

lewing commented Apr 13, 2021

Let me check the versions here, this may be from before that pr

@radical
Copy link
Member

radical commented Apr 13, 2021

The result is likely this change:

-        private static extern void InitializeCurrentThread_icall([NotNull] ref Thread? thread);
+        private static extern Thread GetCurrentThread();

I'm not clear on how this worked before though? A ref type would have hit this before:

else if (t.IsByRef)
{
AppendType (sb, t.GetElementType()!);
sb.Append ('&');
}

But then it should have tried the Thread? We also use that type in other icalls... @vargaz any ideas?

AFAICS:

  1. AppendType is not used for return types
  2. The trace has AppendType -> AppendType
    .. which would be consistent for a Thread& argument.

The change in the icall was:

        [MethodImplAttribute(MethodImplOptions.InternalCall)]
   -      private static extern void InitializeCurrentThread_icall([NotNull] ref Thread? thread);
   +      private static extern Thread GetCurrentThread();
  1. The old one would be Thread&, and would fail with AppendType.
  1. The new one, would not be passed to AppendType at all.

So.. I think this might be a case of old runtime(or cross compiler?), and a newer System.Private.CoreLib?

Please correct me if I'm wrong! I can't reproduce it locally, so I wasn't able to confirm my hypothesis!

@lewing
Copy link
Member Author

lewing commented Apr 13, 2021

Yeah I think the failure may actually have been with the previous version. This was with packaged versions flowing from aspnetcore it may be working in main

@lewing
Copy link
Member Author

lewing commented Apr 13, 2021

I think this was actually fixed by that pr, closing for now

@lewing lewing closed this as completed Apr 13, 2021
@lewing lewing reopened this Apr 13, 2021
@lewing
Copy link
Member Author

lewing commented Apr 14, 2021

This is caused by a version mismatch between the runtime (set in the sdk and was blocked by dotnet/sdk#16810) and the version of the cross toolchain in the manifest.

@lewing lewing closed this as completed Apr 14, 2021
@lewing
Copy link
Member Author

lewing commented Apr 14, 2021

cc @marek-safar

@ghost ghost locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture blocking Marks issues that we want to fast track in order to unblock other important work untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

5 participants