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

net9 - Type System.Object is not blittable: Not a ValueType #110101

Open
1 task done
Dona278 opened this issue Nov 22, 2024 · 9 comments
Open
1 task done

net9 - Type System.Object is not blittable: Not a ValueType #110101

Dona278 opened this issue Nov 22, 2024 · 9 comments
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono untriaged New issue has not been triaged by the area owner

Comments

@Dona278
Copy link

Dona278 commented Nov 22, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

After update a blazor wasm hosted project from net8 to net9 during build / publish I see this in the build output:

message WASM0060: Type System.Object is not blittable: Not a ValueType
message WASM0062: Type System.Runtime.InteropServices.HandleRef is not blittable: Field _wrapper is not blittable
warning WASM0001: Could not get pinvoke, or callbacks for method 'Microsoft.Build.Framework.NativeMethods::GetModuleFileName' because 'System.NotSupportedException: Unsupported parameter type in method 'Microsoft.Build.Framework.NativeMethods.GetModuleFileName'
warning WASM0001:    at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0& )
warning WASM0001:    at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)'

However it seems to works good, but I don't know what generate this warning and what are the conseguences.

Expected Behavior

No see this warning in the output

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

9.0.100

Anything else?

.NET SDK:
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.c6f19616
MSBuild version: 17.12.7+5b8665660

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100\

.NET workloads installed:
[wasm-tools]
Installation Source: SDK 9.0.100
Manifest Version: 9.0.0/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.current\9.0.0\WorkloadManifest.json
Install Type: Msi

[wasm-tools-net8]
Installation Source: SDK 9.0.100
Manifest Version: 9.0.0/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.net8\9.0.0\WorkloadManifest.json
Install Type: Msi

Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9

.NET SDKs installed:
8.0.404 [C:\Program Files\dotnet\sdk]
9.0.100-rc.2.24474.11 [C:\Program Files\dotnet\sdk]
9.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0-rc.2.24474.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
C:\Sources\release\global.json

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

@javiercn
Copy link
Member

@Dona278 thanks for contacting us.

Do you see this during Linking/ AoT compilation?

@Dona278
Copy link
Author

Dona278 commented Nov 23, 2024

@javiercn yes sorry!! I omitted probably the most important setup..
This is a blazor wasm hosted project with RCL referenced as nuget package and both AOT and Trimming enabled as full in the main project and partial in the RCL.

@javiercn javiercn transferred this issue from dotnet/aspnetcore Nov 23, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Nov 23, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Nov 23, 2024
@Dona278
Copy link
Author

Dona278 commented Nov 23, 2024

As soon as I find 5 minutes today I try to write you the exact moment during build but for now I remember the was just before linking the assemblies yes

@vcsjones vcsjones added the arch-wasm WebAssembly architecture label Nov 25, 2024
Copy link
Contributor

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

@Dona278
Copy link
Author

Dona278 commented Nov 25, 2024

As additional information. The warning appear also during normal build which AOT and Linking aren't involved in the process.

@pavelsavara
Copy link
Member

@Dona278
Could you please add steps to reproduce ? Maybe sample repository.

@vcsjones vcsjones removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 3, 2024
@Dona278
Copy link
Author

Dona278 commented Dec 11, 2024

@pavelsavara sorry for the delay but I started from our main project and then remove a piece of code each time to reproduce the smallest repo as possible and I found the issue!
Reference a project which has Microsoft.Build.Utilities.Core as package reference (used to create MSBuild task code) lead to the error described in the issue if the main project has <WasmEnableSIMD>false</WasmEnableSIMD>

To reproduce:
Library.csproj

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFramework>netstandard2.0</TargetFramework>
		<LangVersion>preview</LangVersion>
		<Nullable>enable</Nullable>
	</PropertyGroup>

	<ItemGroup>
		<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.12.6" />
	</ItemGroup>

</Project>

Blazor.Web.csproj

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

	<PropertyGroup>
		<TargetFramework>net9.0</TargetFramework>
		<LangVersion>preview</LangVersion>
		<Nullable>enable</Nullable>
		<ImplicitUsings>enable</ImplicitUsings>
		<NoWarn>$(NoWarn);1591</NoWarn>

		<WasmEnableSIMD>false</WasmEnableSIMD>
	</PropertyGroup>

	<ItemGroup>
		<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
		<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" />
		<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="9.0.0" />
	</ItemGroup>

	<ItemGroup>
		<ProjectReference Include="..\..\Library\Library.csproj" />
	</ItemGroup>

</Project>

If you remove the PackageReference or the WasmEnableSIMD item the error disappear.

@pavelsavara
Copy link
Member

I guess you are not trying to run MSBuild inside of the browser. I suggest that you separate that part of Library.csproj into another project, which you would not reference from Blazor.Web.csproj

@Dona278
Copy link
Author

Dona278 commented Dec 11, 2024

Library already contains only code for custom msbuild task, and it is referenced in blazor (web) with PrivateAssets="all" because some tasks are used at build time. So yes the library is used in a web project, is it wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

5 participants