clockworklabs / clockworklabs/SpacetimeDB

C# Module Requires ImplicitUsings

Open
#2,406 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

Right now, a C# module requires <ImplicitUsings>enable</ImplicitUsings>

Personally, I don't like implicit usings. However, when I turn them off, I get a slew of errors (shown below).

The generated code should include all it's required imports, so that developers can turn ImplicitUsings on or off as they like.

/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(119,24): error CS0246: The type or namespace name 'BinaryReader' could not be found (are you missing a using directive or an assembly reference?) [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(132,24): error CS0246: The type or namespace name 'BinaryReader' could not be found (are you missing a using directive or an assembly reference?) [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(145,24): error CS0246: The type or namespace name 'BinaryReader' could not be found (are you missing a using directive or an assembly reference?) [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(158,24): error CS0246: The type or namespace name 'BinaryReader' could not be found (are you missing a using directive or an assembly reference?) [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(52,12): error CS0246: The type or namespace name 'IEnumerable<>' could not be found (are you missing a using directive or an assembly reference?) [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(87,12): error CS0246: The type or namespace name 'IEnumerable<>' could not be found (are you missing a using directive or an assembly reference?) [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(110,28): error CS0535: 'ModuleRegistration.ClientConnected' does not implement interface member 'IReducer.Invoke(BinaryReader, IReducerContext)' [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(27,42): error CS0738: 'Message' does not implement interface member 'ITableView<Message, Module.Message>.Iter()'. 'Message.Iter()' cannot implement 'ITableView<Message, Module.Message>.Iter()' because it does not have the matching return type of 'IEnumerable<Module.Message>'. [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(58,31): error CS0738: 'User' does not implement interface member 'ITableView<User, Module.User>.Iter()'. 'User.Iter()' cannot implement 'ITableView<User, Module.User>.Iter()' because it does not have the matching return type of 'IEnumerable<Module.User>'. [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(123,27): error CS0535: 'ModuleRegistration.ClientDisconnected' does not implement interface member 'IReducer.Invoke(BinaryReader, IReducerContext)' [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(136,20): error CS0535: 'ModuleRegistration.SendMessage' does not implement interface member 'IReducer.Invoke(BinaryReader, IReducerContext)' [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(18,72): error CS0246: The type or namespace name 'Random' could not be found (are you missing a using directive or an assembly reference?) [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(149,16): error CS0535: 'ModuleRegistration.SetName' does not implement interface member 'IReducer.Invoke(BinaryReader, IReducerContext)' [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]
/home/nicholas/Projects/Games/MMO/quickstart-chat/server/SpacetimeDB.Codegen/SpacetimeDB.Codegen.Module/FFI.cs(12,25): error CS0246: The type or namespace name 'Random' could not be found (are you missing a using directive or an assembly reference?) [/home/nicholas/Projects/Games/MMO/quickstart-chat/server/StdbModule.csproj]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the generated FFI.cs referenced in the compiler errors and the StdbModule.csproj with ImplicitUsings disabled. Reproduce the build to identify which required imports are absent; done means the generated C# module compiles successfully without relying on implicit usings.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.