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] MarshalingPInvokeScanner fails when using a nested value type contained in a different assembly. #110938

Open
FriendSea opened this issue Dec 25, 2024 · 1 comment
Labels
arch-wasm WebAssembly architecture area-Interop-mono untriaged New issue has not been triaged by the area owner

Comments

@FriendSea
Copy link

Description

In a WASM project, when using NativeFileReference for linking, it seems that the types used in DllImport are being scanned.
However, this process does not appear to support nested types contained in other assemblies.

It seems like the issue stems from the assumption that the parent of the type is always an AssemblyReference.
https://github.com/dotnet/runtime/blob/main/src/tasks/MonoTargetsTasks/MarshalingPInvokeScanner/MinimalMarshalingTypeCompatibilityProvider.cs#L142

Reproduction Steps

Download the zip file and try building the WasmProject.
dotnet_wasm_issue.zip

This project uses the wasmconsole template as the minimal setup to reproduce the issue, but the same problem occurs in Blazor WebAssembly as well.

Expected behavior

The project should build and run successfully.

Actual behavior

Error occurs.

C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\8.0.11\Sdk\WasmAp
p.Native.targets(737,5): error MSB4018: "MarshalingPInvokeScanner" タスクが予期せずに 失敗しました。

C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\8.0.11\Sdk\WasmAp
p.Native.targets(737,5): error MSB4018: System.NotImplementedException: Unsupported R
esolutionScope kind 'TypeReference' used in type :InnerValueType.

Regression?

No response

Known Workarounds

There is no issue when using top-level types, even if they are contained in a different assembly.

Configuration

No response

Other information

No response

@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 Dec 25, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 25, 2024
@jkotas jkotas added arch-wasm WebAssembly architecture area-Interop-mono labels Dec 25, 2024
Copy link
Contributor

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

@jkotas jkotas removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-Interop-mono untriaged New issue has not been triaged by the area owner
Projects
Status: No status
Development

No branches or pull requests

2 participants