dotnet / dotnet/roslyn

Title: Add “Strict Member Mode” to Visual Studio / Roslyn to prevent common beginner mistakes (e.g., text vs Text)

Open
#82,204 2 comments 0 reactions 0 assignees View on GitHub
Area-IDE Feature Request
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

Summary
Many beginners frequently make mistakes like writing text instead of Text when accessing properties such as TextBox.Text.
Currently, Visual Studio and Roslyn do not warn the user until compile time, because the IDE assumes the member might be added later via partial classes, extension methods, or source generators.
However, in 99% of beginner and standard application development, such “later addition” does not happen.
This leads to unnecessary confusion and frustration.
Proposal
Introduce an optional strict mode that developers can enable per file, per class, or per project:
#strictmembers

Behavior in strict mode
- If a member does not exist at the time of writing, the IDE immediately reports an error.
- The IDE does not assume the member may appear later via:
- partial classes
- extension methods
- source generators
- conditional compilation
- This prevents common mistakes such as:
- MainTx.text (typo)
- label1.tex (typo)
- button1.clik (typo)
Optional override
If the developer intentionally wants to reference a member that will be added later, they can explicitly mark it:
MainTx.!text

This tells the IDE:
“This member will be added later. Do not warn.”

Why this is useful
- Dramatically improves the beginner experience
- Prevents extremely common UI-typo bugs
- Does not break existing C# language rules
- Does not affect advanced users unless they enable strict mode
- Keeps backward compatibility
- Easy to implement at the IDE / Roslyn analyzer level
Motivation
Beginners often struggle because the IDE does not warn them about obvious mistakes.
A strict mode would make Visual Studio far more friendly and reduce frustration.

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Start by reviewing Roslyn's existing member-binding diagnostics and the constraints involving partial classes, extension methods, source generators, and conditional compilation. Done would require an agreed design for strict mode scope, syntax, exceptions, and compatibility before implementation can begin.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.