Stream: general

Topic: Error when exporting resource in C#


view this post on Zulip godotdot (Jan 11 2026 at 02:04):

Hey all,

I'm getting an error while trying to use resources with componentize-dotnet that I am unsure how to deal with.

noct@ubuntu:/home/noct/0/projects/gamedev/wac_test_2/DatabasePlugin$ dotnet build
Restore complete (0.3s)
  DatabasePlugin net10.0 wasi-wasm failed with 1 error(s) (0.1s)
    /home/noct/0/projects/gamedev/wac_test_2/DatabasePlugin/obj/Debug/net10.0/wasi-wasm/wit_bindgen/DatabasePluginWorld.wit.exports.serverSandbox.pluginMod.IDatabasePluginExportsToLogicPlugin.cs(13,25): error CS0246: The type or namespace name 'RepTable<>' could not be found (are you missing a using directive or an assembly reference?)

Build failed with 1 error(s) in 0.7s

This occurs with the following project/source files:

DatabasePlugin.csproj:

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

  <PropertyGroup>
    <OutputType>library</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>
    <UseAppHost>false</UseAppHost>
    <PublishTrimmed>true</PublishTrimmed>
    <InvariantGlobalization>true</InvariantGlobalization>
    <SelfContained>true</SelfContained>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="BytecodeAlliance.Componentize.DotNet.Wasm.SDK" Version="0.7.0-preview00010" />
    <PackageReference Include="runtime.linux-x64.microsoft.dotnet.ilcompiler.llvm" Version="10.0.0-preview.2.25509.1" />
    <Wit Update="database_plugin.wit" World="database-plugin" />
  </ItemGroup>

</Project>

DatabasePlugin.cs:

namespace DatabasePluginWorld;

public class DatabasePluginExportsToLogicPluginImpl
{
     public static void PrintDatabasePlugin(String caller)
     {
         Console.WriteLine("PrintDatabasePlugin: caller: {caller}");
     }

     public class UnitTable
     {
         public static int Insert(String name)
         {
             return 12345;
         }
     }
}

database_plugin.wit:

package server-sandbox:plugin-mod;

interface database-plugin-exports-to-logic-plugin {
    print-database-plugin: func(caller: string);

    resource unit-table {
        insert: static func(name: string) -> int;
    }
}


world database-plugin {
    export database-plugin-exports-to-logic-plugin;
}

Like said, I am not really sure what I am doing wrong. I've noticed there is a RepTable defined in the wit-bindgen repository for C#, which has me wondering if that was supposed to be included somewhere in the generation process?

Other than that, I didn't find any examples of how to use resources in C#, so I've basically been trying to puzzle it out on my own; are there any examples that I could take a look at?


Last updated: Jan 29 2026 at 13:25 UTC