Skip to content

[wasm] Changing DllImport does not result in a new wasm module #95192

Closed
@silesmo

Description

@silesmo

Description

Rebuilding a project targeting the wasi-experimental workload when changing the arguments in the DllImport attribute doesn't result in a new wasm module to be built.

I have built this tool that you can use to see all the imports and exports easily directly in the browser, that can hopefully assist when checking the produced wasm: https://wa2.dev/

@lewing

Reproduction Steps

Build module using nightly targeting wasi-experimental workload

Example function:

    internal static class Float32ParamInterop
    {
        [WasmImportLinkage]
        [DllImport("foo", EntryPoint = "float32-param")]
        internal static extern void wasmImportFloat32Param(float p0);
    }

Then change the EntryPoint to "float32-param-test":

    internal static class Float32ParamInterop
    {
        [WasmImportLinkage]
        [DllImport("foo", EntryPoint = "float32-param-test")]
        internal static extern void wasmImportFloat32Param(float p0);
    }

Rebuild using dotnet build -c Release
Observe that the import name hasn't changed.

If I delete the bin folder and run dotnet build -c Release then all the files except the wasm module is created in bin/Release/net9.o/wasi-wasm/AppBundle
image

It's not until I delete the obj folder that it actually builds and produces the new wasm module as expected.

Expected behavior

That the module is rebuilt and produces a new wasm module with the correct import module and function name.

Actual behavior

Doesn't produce a new wasm module without deleting the obj folder.

Regression?

Related to: #94615

Known Workarounds

Delete obj folder and rebuild.

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions