Skip to content

csharp-unity-conventions rule recommends C# 10/12 features that Unity 6 (C# 9) cannot compile #30

Description

@TMHSDigital

Why it matters

This rule is injected into the AI's context for C# work and tells it to use language features Unity 6 cannot compile. Every file the AI writes with these patterns fails to build, and it contradicts the project's own "must compile on Unity 6.x" standard.

Evidence

rules/csharp-unity-conventions.mdc:23-24:

- Use file-scoped namespaces to reduce nesting
- Prefer primary constructors for simple data types

Unity 6.x compiles C# 9. File-scoped namespaces are C# 10 and primary constructors for classes/structs are C# 12. Every snippet in the repo also uses block-scoped namespaces, so the rule contradicts the snippets.

Suggested approach

  • Remove both lines; replace with "Unity 6 uses C# 9: do not use file-scoped namespaces, primary constructors, required members, raw string literals, or collection expressions".
  • Add a CI grep guard for ^namespace .*;$ in .cs files and these phrases in rules/skills.

Done when

No rule or skill recommends C# features above C# 9, and CI guards against regressions.

Activity

  1. TMHSDigital commented on Oct 9, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in #49.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions