dotnet / dotnet/roslyn

Errors and warnings related to property declarations CS0200 is incorrect

Open
#84,805 4 comments 0 reactions 1 assignee Claimed by @adegeo View on GitHub
Area-Compilers Concept-Diagnostic Clarity
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

### Describe the issue or suggestion

The warning is allways show:
[CS0200](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/property-declaration-errors?f1url=%3FappId%3Droslyn%26k%3Dk(CS0200)#readonly-properties): Property or indexer 'property' cannot be assigned to -- it is read only

event actual operator is different (++,+=,-=,*=1/=..)

Expect: show corresponding with current operator in code editor
ENV:
- VS 2026 18.2
- .NET 10.0

Image

---
#### Document Details

⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*

* ID: eec6bb12-2d42-d658-778e-31860b1ffc76
* Version Independent ID: 461910d2-3b9c-0e9a-f3bd-f84d3d02d735
* Platform ID: 59208486-001a-a37c-318b-00b76f7d0d70
* Content: [Compiler Errors on property declarations - C# reference](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/property-declaration-errors?f1url=%3FappId%3Droslyn%26k%3Dk(CS0200)#readonly-properties)
* Content Source: [docs/csharp/language-reference/compiler-messages/property-declaration-errors.md](https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/compiler-messages/property-declaration-errors.md)
* Service: **dotnet-csharp**
* Sub-service: **errors-warnings**
* GitHub Login: @BillWagner
* Microsoft Alias: **wiwagn**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.