#2406Requested

C# Module Requires ImplicitUsings

Requested on GitHub by CloneDeath
Energy Committed0TeV

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,2
  1. bfops added the feature-request label Apr 2, 2025
  2. Thanks for reporting! We'll work on getting this fixed.

Boost this Request

Reopen this request?

The request will return to its prior live status.

Mark as Duplicate

Pick the request that C# Module Requires ImplicitUsings is a duplicate of. Energy rolls up into that request and GitHub closes the linked issue as a duplicate with a timeline reference to the canonical.

Unmark Duplicate

Restore as an independent request. The linked GitHub issue will be reopened and its duplicate-of relationship cleared. The original timeline entries stay as history; the note below is posted as a follow-up comment.