-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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] Unmanaged structs are considered blittable if module has DisableRuntimeMarshallingAttribute
#73310
[wasm] Unmanaged structs are considered blittable if module has DisableRuntimeMarshallingAttribute
#73310
Conversation
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
Tagging subscribers to 'arch-wasm': @lewing |
This is not entirely true. An unmanaged struct defined in an assembly with DisableRuntimeMarshalling isn't necessarily blittable if it is used in a P/Invoke in an assembly without DisableRuntimeMarshallingAttribute. |
…leRuntimeMarshallingAttribute.
e32a7b8
to
4e044cf
Compare
Thanks! |
Only the P/Invoke assembly must be marked with the attribute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look for the DisableRuntimeMarshallingAttribute on the assembly where pinvoke method is declared.
Mistake...
… pinvoke method is declared.
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
…rDisableRuntimeMarshalling
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
Co-authored-by: Ankit Jain <radical@gmail.com>
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
…isableRuntimeMarshalling
src/tests/BuildWasmApps/Wasm.Build.Tests/PInvokeTableGeneratorTests.cs
Outdated
Show resolved
Hide resolved
src/tests/BuildWasmApps/Wasm.Build.Tests/PInvokeTableGeneratorTests.cs
Outdated
Show resolved
Hide resolved
src/tests/BuildWasmApps/Wasm.Build.Tests/PInvokeTableGeneratorTests.cs
Outdated
Show resolved
Hide resolved
src/tests/BuildWasmApps/Wasm.Build.Tests/PInvokeTableGeneratorTests.cs
Outdated
Show resolved
Hide resolved
src/tests/BuildWasmApps/Wasm.Build.Tests/PInvokeTableGeneratorTests.cs
Outdated
Show resolved
Hide resolved
src/tests/BuildWasmApps/Wasm.Build.Tests/PInvokeTableGeneratorTests.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
.. callbacks with function pointers.
…isableRuntimeMarshalling
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
The Linux_musl x64 coreclr failure is #73930 . |
{ | ||
_assemblyDisableRuntimeMarshallingAttributeCache[assembly] = value = assembly | ||
.GetCustomAttributesData() | ||
.Any(d => d.AttributeType.Name == "DisableRuntimeMarshallingAttribute"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can use nameof(DisableRuntimeMarshallingAttribute)
with using System.Runtime.CompilerServices;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assembly is also compiled for net47 and the attribute is not available there.
Consider all types in pinvokes from assembly marked with
DisableRuntimeMarshallingAttribute
as blittable.Based on API proposal in #60639.
Fixes #61146.