Skip to content

Commit 24bcbf3

Browse files
committed
Merge remote-tracking branch 'upstream/main' into record-unsafe-types
* upstream/main: (172 commits) Move impl of ILspWorkpace to EditorTestWorkspace/LspTestWorkspace (dotnet#76753) Field-backed properties: report diagnostic for variable named field declared in accessor (dotnet#76671) Add more tests Update 'use nameof instead of typeof' to support generic types Update dependencies from https://github.com/dotnet/arcade build 20250115.2 Add docs invert Update src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems Update options Fixup tests fixup options Update tests Add test Fix trivia Handle params Support modifiers with simple lambda parameters. (dotnet#75400) Handle params Use helper Add fixes Flesh out ...
2 parents a9fe12d + 1412b9c commit 24bcbf3

File tree

202 files changed

+9183
-2597
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+9183
-2597
lines changed

docs/Language Feature Status.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ efforts behind them.
1010

1111
| Feature | Branch | State | Developer | Reviewer | IDE Buddy | LDM Champ |
1212
| ------- | ------ | ----- | --------- | -------- | --------- | --------- |
13-
| String literals in data section as UTF8 | [PR](https://github.com/dotnet/roslyn/pull/76036) | [In Progress](https://github.com/dotnet/roslyn/issues/76234) | [jjonescz](https://github.com/jjonescz) | [AlekseyTs](https://github.com/AlekseyTs), [jcouv](https://github.com/jcouv) | N/A | N/A |
1413
| Runtime Async | [features/runtime-async](https://github.com/dotnet/roslyn/tree/features/runtime-async) | [In Progress](https://github.com/dotnet/roslyn/issues/75960) | [333fred](https://github.com/333fred) | [jcouv](https://github.com/jcouv), [RikkiGibson](https://github.com/RikkiGibson) | | |
1514
| [Simple lambda parameters with modifiers](https://github.com/dotnet/csharplang/blob/main/proposals/simple-lambda-parameters-with-modifiers.md) | [PR](https://github.com/dotnet/roslyn/pull/75400) | [In Progress](https://github.com/dotnet/roslyn/issues/76298) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [jjonescz](https://github.com/jjonescz), [cston](https://github.com/cston) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) |
1615
| [Null-conditional assignment](https://github.com/dotnet/csharplang/issues/6045) | [null-conditional-assignment](https://github.com/dotnet/roslyn/tree/features/null-conditional-assignment) | [In Progress](https://github.com/dotnet/roslyn/issues/75554) | [RikkiGibson](https://github.com/RikkiGibson) | [cston](https://github.com/cston), [jjonescz](https://github.com/jjonescz) | TBD | [RikkiGibson](https://github.com/RikkiGibson) |
@@ -19,6 +18,7 @@ efforts behind them.
1918
| [`field` keyword in properties](https://github.com/dotnet/csharplang/issues/140) | [field-keyword](https://github.com/dotnet/roslyn/tree/features/field-keyword) | [Merged into 17.12p3](https://github.com/dotnet/roslyn/issues/57012) | [Youssef1313](https://github.com/Youssef1313), [cston](https://github.com/cston) | [333fred](https://github.com/333fred), [RikkiGibson](https://github.com/RikkiGibson) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) |
2019
| [First-class Span Types](https://github.com/dotnet/csharplang/issues/7905) | [FirstClassSpan](https://github.com/dotnet/roslyn/tree/features/FirstClassSpan) | [Merged into 17.13p1](https://github.com/dotnet/roslyn/issues/73445) | [jjonescz](https://github.com/jjonescz) | [cston](https://github.com/cston), [333fred](https://github.com/333fred) | | [333fred](https://github.com/333fred), [stephentoub](https://github.com/stephentoub) |
2120
| [Unbound generic types in `nameof`](https://github.com/dotnet/csharplang/issues/8480) | [PR](https://github.com/dotnet/roslyn/pull/75368) | [Merged into 17.13p2](https://github.com/dotnet/roslyn/pull/75368) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [jcouv](https://github.com/jcouv), [AlekseyTs](https://github.com/AlekseyTs) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) |
21+
| [String literals in data section as UTF8](https://github.com/dotnet/roslyn/blob/main/docs/features/string-literals-data-section.md) | [PR](https://github.com/dotnet/roslyn/pull/76036) | [Merged into 17.14p1](https://github.com/dotnet/roslyn/issues/76234) | [jjonescz](https://github.com/jjonescz) | [AlekseyTs](https://github.com/AlekseyTs), [cston](https://github.com/cston) | N/A | N/A |
2222

2323
# Working Set VB
2424

docs/compilers/CSharp/Compiler Breaking Changes - DotNet 10.md

+80
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22

33
This document lists known breaking changes in Roslyn after .NET 9 general release (.NET SDK version 9.0.100) through .NET 10 general release (.NET SDK version 10.0.100).
44

5+
## `scoped` in a lambda parameter list is now always a modifier.
6+
7+
***Introduced in Visual Studio 2022 version 17.13***
8+
9+
C# 14 introduces the ability to write a lambda with parameter modifiers, without having to specify a parameter type:
10+
https://github.com/dotnet/csharplang/blob/main/proposals/simple-lambda-parameters-with-modifiers.md
11+
12+
As part of this work, a breaking change was accepted where `scoped` will always be treated as a modifier
13+
in a lambda parameter, even where it might have been accepted as a type name in the past. For example:
14+
15+
```c#
16+
var v = (scoped scoped s) => { ... };
17+
18+
ref struct @scoped { }
19+
```
20+
21+
In C# 14 this will be an error as both `scoped` tokens are treated as modifiers. The workaround is to
22+
use `@` in the type name position like so:
23+
24+
```c#
25+
var v = (scoped @scoped s) => { ... };
26+
27+
ref struct @scoped { }
28+
```
29+
530
## `Span<T>` and `ReadOnlySpan<T>` overloads are applicable in more scenarios in C# 14 and newer
631

732
***Introduced in Visual Studio 2022 version 17.13***
@@ -194,6 +219,61 @@ namespace Microsoft.CodeAnalysis;
194219
public class EmbeddedAttribute : Attribute {}
195220
```
196221

222+
## Expression `field` in a property accessor refers to synthesized backing field
223+
224+
***Introduced in Visual Studio 2022 version 17.12***
225+
226+
The expression `field`, when used within a property accessor, refers to a synthesized backing field for the property.
227+
228+
The warning CS9258 is reported when the identifier would have bound to a different symbol with language version 13 or earlier.
229+
230+
To avoid generating a synthesized backing field, and to refer to the existing member, use 'this.field' or '@field' instead.
231+
Alternatively, rename the existing member and the reference to that member to avoid a conflict with `field`.
232+
233+
```csharp
234+
class MyClass
235+
{
236+
private int field = 0;
237+
238+
public object Property
239+
{
240+
get
241+
{
242+
// warning CS9258: The 'field' keyword binds to a synthesized backing field for the property.
243+
// To avoid generating a synthesized backing field, and to refer to the existing member,
244+
// use 'this.field' or '@field' instead.
245+
return field;
246+
}
247+
}
248+
}
249+
```
250+
251+
## Variable named `field` disallowed in a property accessor
252+
253+
***Introduced in Visual Studio 2022 version 17.14***
254+
255+
The expression `field`, when used within a property accessor, refers to a synthesized backing field for the property.
256+
257+
The error CS9272 is reported when a local, or a parameter of a nested function, with the name `field` is declared in a property accessor.
258+
259+
To avoid the error, rename the variable, or use `@field` in the declaration.
260+
261+
```csharp
262+
class MyClass
263+
{
264+
public object Property
265+
{
266+
get
267+
{
268+
// error CS9272: 'field' is a keyword within a property accessor.
269+
// Rename the variable or use the identifier '@field' instead.
270+
int field = 0;
271+
return @field;
272+
}
273+
}
274+
}
275+
```
276+
197277
## `record` and `record struct` types cannot define pointer type members, even when providing their own Equals implementations
198278

199279
***Introduced in Visual Studio 2022 version 17.14***

0 commit comments

Comments
 (0)