clockworklabs / clockworklabs/SpacetimeDB

C#: Reducers and types with same name but different capitalization have bad error text

Open
#1,732 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

If you have a module with following table and reducer, there are no errors in IDE, but publishing returns a fairly unhelpful error

[Table]
public partial class Test { }

[Reducer]
public static void test() { }

Publishing error:

CSC : warning CS8785: Generator 'Module' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'ArgumentException' with message 'The hintName 'Module.test.cs' of the added source file must be unique within a generator.
CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point

Note: This can also happen with two reducers or two tables - it doesn't need to be a combination of both.

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 reproducing the sample module with a table and reducer whose names differ only by capitalization, then trace the C# module source generator used during publishing. Confirm the duplicate hintName error and identify the generator entry point responsible; done means publishing this case no longer produces that error, including when both items are reducers or tables.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.