Skip to content

csharp bindgen issues #1515

@kavoc-brown

Description

@kavoc-brown

Summary

This issue buckets several problems in wit-bindgen csharp to avoid opening many separate issues at once.

Each sub-item is independently reproducible and makes the generated C# fail to build.

If you prefer, I can split this bucket into separate issues.

Repro template

WIT_BINDGEN=wit-bindgen
OUT=/tmp/wit-csharp
rm -rf "$OUT" && mkdir -p "$OUT"

"$WIT_BINDGEN" csharp --runtime native-aot --out-dir "$OUT" /tmp/CASE.wit

cat > "$OUT/Repro.csproj" <<'XML'
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>
</Project>
XML

dotnet build -c Release "$OUT/Repro.csproj"

Sub-issues

Sub-issue 1

Reproduction

package local:demo;

world w {
  export i;
}

interface i {
  /// */
  record r {
    x: u32,
  }
}

Sub-issue 2

Reproduction

package local:demo;

world w {
  export i;
}

interface i {
  resource wasm-interop;

  foo: func(x: own<wasm-interop>);
}

Sub-issue 3

Reproduction

package local:demo;

world w {
  import i;
}

interface i {
  resource t-handle;
}

Sub-issue 4

Reproduction

package local:demo;

world w {
  export i;
}

interface i {
  resource r;
}

Sub-issue 5

Reproduction

package local:demo;

world w {
  import i;
}

interface i {
  foo: func(cleanups: string);
}

Sub-issue 6

Reproduction

package local:demo;

world w {
  export i;
}

interface i {
  foo: func(DELEGATE: u32);
}

Sub-issue 7

Reproduction

package local:demo;

world w {
  export i;
}

interface i {
  variant tags {
    a,
  }

  foo: func(x: tags);
}

Metadata

Metadata

Assignees

Labels

gen-c#Related to the C# code generator

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions