Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,9 @@
"_csharplang/proposals/csharp-13.0/ref-struct-interfaces.md": "This proposal provides features that enable interface authors to allow `ref struct` types to implement a particular interface",
"_csharplang/proposals/csharp-13.0/partial-properties.md": "This proposal provides for partial properties and indexers, allowing the definition of a property or indexer to be split across multiple parts.",
"_csharplang/proposals/csharp-13.0/overload-resolution-priority.md": "This proposal introduces a new attribute, `OverloadResolutionPriorityAttribute`, that can be applied to methods to influence overload resolution.",
"_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md": "Learn about any breaking changes since the initial release of C# 10",
"_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 8.md": "Learn about any breaking changes since the initial release of C# 11",
"_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 9.md": "Learn about any breaking changes since the initial release of C# 12",
"_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md": "Learn about any breaking changes since the initial release of C# 10 and included in C# 11",
"_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 8.md": "Learn about any breaking changes since the initial release of C# 11 and included in C# 12",
"_roslyn/docs/compilers/CSharp/Compiler Breaking Changes - DotNet 9.md": "Learn about any breaking changes since the initial release of C# 12 and included in C# 13",
"_vblang/spec/introduction.md": "This chapter provides and introduction to the Visual Basic language.",
"_vblang/spec/lexical-grammar.md": "This chapter defines the lexical grammar for Visual Basic.",
"_vblang/spec/preprocessing-directives.md": "This chapter defines the preprocessing directives allowed in Visual Basic",
Expand Down
10 changes: 5 additions & 5 deletions docs/azure/includes/dotnet-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@
| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.ContentSafety.Extension.Embedded.Text/1.0.0)<br>NuGet [1.0.1-beta.3](https://www.nuget.org/packages/Azure.AI.ContentSafety.Extension.Embedded.Text/1.0.1-beta.3) | | |
| Unknown Display Name | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Developer.MicrosoftPlaywrightTesting.NUnit/1.0.0-beta.2) | | |
| Unknown Display Name | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/1.0.0-beta.2) | | |
| Unknown Display Name | NuGet [1.0.3-preview](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.MySql/1.0.3-preview) | | |
| Unknown Display Name | NuGet [1.0.3-preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.MySql/1.0.3-preview) | | |
| Unknown Display Name | NuGet [1.0.4-preview](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.MySql/1.0.4-preview) | | |
| Unknown Display Name | NuGet [1.0.4-preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.MySql/1.0.4-preview) | | |
| Unknown Display Name | NuGet [1.41.1](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.CLI/1.41.1) | | |
| Unknown Display Name | NuGet [1.41.1](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Embedded.SR/1.41.1) | | |
| Unknown Display Name | NuGet [1.41.1](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Embedded.TTS/1.41.1) | | |
Expand Down Expand Up @@ -571,8 +571,8 @@
| Hyak Common - Tracing Etw | NuGet [1.0.2](https://www.nuget.org/packages/Hyak.Common.Tracing.Etw/1.0.2) | | |
| Hyak Common - Tracing Log4Net | NuGet [1.0.2](https://www.nuget.org/packages/Hyak.Common.Tracing.Log4Net/1.0.2) | | |
| Microsoft.Azure.SignalR.Emulator | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.SignalR.Emulator/1.4.0)<br>NuGet [1.0.0-preview1-10809](https://www.nuget.org/packages/Microsoft.Azure.SignalR.Emulator/1.0.0-preview1-10809) | | |
| MSBuild | NuGet [0.30.0](https://www.nuget.org/packages/Microsoft.TypeSpec.MSBuild/0.30.0) | | |
| ProviderHub Controller | NuGet [0.16.0](https://www.nuget.org/packages/Microsoft.TypeSpec.ProviderHub.Controller/0.16.0) | | |
| ProviderHub Templates | NuGet [1.8.0](https://www.nuget.org/packages/Microsoft.TypeSpec.ProviderHub.Templates/1.8.0) | | |
| MSBuild | NuGet [0.31.0](https://www.nuget.org/packages/Microsoft.TypeSpec.MSBuild/0.31.0) | | |
| ProviderHub Controller | NuGet [0.17.0](https://www.nuget.org/packages/Microsoft.TypeSpec.ProviderHub.Controller/0.17.0) | | |
| ProviderHub Templates | NuGet [1.9.0](https://www.nuget.org/packages/Microsoft.TypeSpec.ProviderHub.Templates/1.9.0) | | |
| Template | NuGet [1.0.2-preview1](https://www.nuget.org/packages/Microsoft.Azure.Template/1.0.2-preview1) | | |
| Test HttpRecorder | NuGet [1.13.3](https://www.nuget.org/packages/Microsoft.Azure.Test.HttpRecorder/1.13.3) | | GitHub [1.13.3](https://github.com/Azure/azure-sdk-for-net/tree/mgmt-legacy/sdk/mgmtcommon/TestFramework/Microsoft.Azure.Test.HttpRecorder) |
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ f1_keywords:
- "CS9202"
- "CS9211"
- "CS9240"
- "CS9260"
helpviewer_keywords:
- "CS0171"
- "CS0188"
Expand Down Expand Up @@ -107,7 +108,8 @@ helpviewer_keywords:
- "CS9202"
- "CS9211"
- "CS9240"
ms.date: 11/02/2023
- "CS9260"
ms.date: 11/06/2024
---
# Resolve warnings related to language features and versions

Expand Down Expand Up @@ -149,6 +151,7 @@ That's be design. The text closely matches the text of the compiler error / warn
- **CS9202**: *Feature is not available in C# 12.0. Please use newer language version*
- **CS9211**: *The diagnosticId argument to the 'Experimental' attribute must be a valid identifier.*
- **CS9240**: *Target runtime doesn't support by-ref-like generics.*
- **CS9260**: *Feature is not available in C# 13.0. Please use newer language version**

In addition, the following errors and warnings relate to struct initialization changes in recent versions:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ f1_keywords:
- "CS9183"
- "CS9184"
- "CS9189"
- "CS9259"
helpviewer_keywords:
- "CS9164"
- "CS9165"
Expand All @@ -31,7 +32,8 @@ helpviewer_keywords:
- "CS9183"
- "CS9184"
- "CS9189"
ms.date: 11/02/2023
- "CS9259"
ms.date: 11/06/2024
---
# Resolve errors and warnings with inline array declarations

Expand All @@ -54,6 +56,7 @@ That's by design. The text closely matches the text of the compiler error / warn
- [**CS9183**](#conversions-to-span): *Inline array conversion operator will not be used for conversion from expression of the declaring type.*
- [**CS9184**](#inline-array-declaration): *'Inline arrays' language feature is not supported for inline array types with element field which is either a '`ref`' field, or has type that is not valid as a type argument.*
- [**CS9189**](#element-access): *`foreach` statement on an inline array of type is not supported*
- [**CS9259**](#inline-array-declaration): *Attribute <xref:System.Runtime.CompilerServices.InlineArrayAttribute?displayProperty=fullName> cannot be applied to a record struct.*

## Inline array declaration

Expand All @@ -64,6 +67,7 @@ You declare inline arrays as a `struct` type with a single field, and an attribu
- **CS9169**: *Inline array struct must declare one and only one instance field which must not be a ref field.*
- **CS9180**: *Inline array element field cannot be declared as required, readonly, volatile, or as a fixed size buffer.*
- **CS9184**: *'Inline arrays' language feature is not supported for inline array types with element field which is either a '`ref`' field, or has type that is not valid as a type argument.*
- **CS9259**: *Attribute <xref:System.Runtime.CompilerServices.InlineArrayAttribute?displayProperty=fullName> cannot be applied to a record struct.*

To fix these arrays, ensure the following are true:

Expand All @@ -72,6 +76,7 @@ To fix these arrays, ensure the following are true:
- The enclosing `struct` has a single instance field, and that instance field is not a `ref` field.
- The single instance field is not a fixed size buffer.
- The single instance field doesn't include the `required`, `volatile`, or `readonly` modifiers.
- Remove the `record` modifier from your inline array declaration.

## Element access

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ f1_keywords:
- "CS9199"
- "CS9200"
- "CS9201"
- "CS9265"
helpviewer_keywords:
- "CS0192"
- "CS0199"
Expand Down Expand Up @@ -131,7 +132,8 @@ helpviewer_keywords:
- "CS9199"
- "CS9200"
- "CS9201"
ms.date: 11/02/2023
- "CS9265"
ms.date: 11/06/2024
---
# Errors and warnings associated with reference parameters, variables, and returns

Expand Down Expand Up @@ -207,6 +209,7 @@ The following warnings are generated when reference variables are used incorrect
- [**CS9198**](#reference-variable-restrictions): *Reference kind modifier of parameter doesn't match the corresponding parameter in target.*
- [**CS9200**](#reference-variable-restrictions): *A default value is specified for `ref readonly` parameter, but `ref readonly` should be used only for references. Consider declaring the parameter as `in`.*
- [**CS9201**](#reference-variable-restrictions): *Ref field should be ref-assigned before use.*
- [**CS9265**](#reference-variable-restrictions): *Field is never ref-assigned to, and will always have its default value (null reference)*

These errors and warnings follow these themes:

Expand Down Expand Up @@ -261,6 +264,7 @@ The following warnings indicate that a reference variable shouldn't be used, and
- **CS9198**: *Reference kind modifier of parameter doesn't match the corresponding parameter in target.*
- **CS9200**: *A default value is specified for `ref readonly` parameter, but `ref readonly` should be used only for references. Consider declaring the parameter as `in`.*
- **CS9201**: *Ref field should be ref-assigned before use.*
- **CS9265**: *Field is never ref-assigned to, and will always have its default value (null reference)*

To fix the error, remove the reference variable where it isn't allowed:

Expand All @@ -277,6 +281,7 @@ To fix the error, remove the reference variable where it isn't allowed:
- Methods attributed with <xref:System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute?displayProperty=nameWithType> can't use reference parameters.
- A Windows runtime event can't be passed as a reference variable.
- A `ref readonly` parameter can't have the <xref:System.Runtime.InteropServices.OutAttribute?displayProperty=nameWithType> applied to it in remoting API.
- Initialize a `ref` field in the constructor or as a field initializer.

## `unscoped ref` restrictions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ f1_keywords:
- "CS9245"
- "CS9246"
- "CS9247"
- "CS9267"
helpviewer_keywords:
- "CS8343"
- "CS8344"
Expand All @@ -29,7 +30,8 @@ helpviewer_keywords:
- "CS9245"
- "CS9246"
- "CS9247"
ms.date: 07/30/2024
- "CS9267"
ms.date: 11/06/2024
---
# Errors and warnings associated with `ref struct` types

Expand All @@ -46,6 +48,7 @@ ms.date: 07/30/2024
- [**CS9245**](#ref-struct-interface-implementations): *Type cannot implement interface member for `ref struct` type.*
- [**CS9246**](#ref-struct-interface-implementations): *A non-virtual instance interface member cannot be accessed on a type parameter that allows ref struct.*
- [**CS9247**](#ref-struct-interface-implementations): *foreach statement cannot operate on enumerators of type because it is a type parameter that allows ref struct and it is not known at compile time to implement `IDisposable`.*
- [**CS9267**](#ref-struct-interface-implementations): *Element type of an iterator may not be a ref struct or a type parameter allowing ref structs*

## ref safety violations

Expand Down Expand Up @@ -74,6 +77,7 @@ Violating any of these rules produces one of the listed errors. If you intended
- **CS9245**: *Type cannot implement interface member for `ref struct` type.*
- **CS9246**: *A non-virtual instance interface member cannot be accessed on a type parameter that allows ref struct.*
- **CS9247**: *foreach statement cannot operate on enumerators of type because it is a type parameter that allows ref struct and it is not known at compile time to implement `IDisposable`.*
- **CS9267**: *Element type of an iterator may not be a ref struct or a type parameter allowing ref structs*

Prior to C# 13, [`ref struct`](../builtin-types/ref-struct.md) types can't implement interfaces; the compiler generates *CS8343*. Beginning with C# 13, `ref struct` types can implement interfaces, subject to the following rules:

Expand All @@ -84,3 +88,4 @@ Beginning with C# 13, a `ref struct` can be used as a type argument for a generi

- A `ref struct` is used as a type argument, the type parameter *must* have the `allows ref struct` anti-constraint.- The `allows ref struct` anti-constraint must be last in the `where` clause for that parameter
- Uses of instances the type parameter must obey ref safety rules.
- A `ref struct` or a type argument that can be a `ref struct` type can't be used as the element type for an [iterator method](../statements/yield.md).
8 changes: 4 additions & 4 deletions docs/csharp/language-reference/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ items:
CS0171, CS0188, CS0843, CS8904, CS1738, CS8022, CS8023, CS8024, CS8025, CS8026, CS8058, CS8059, CS8107, CS8192, CS8302,
CS8303, CS8304, CS8305, CS8306, CS8314, CS8320, CS8370, CS8371, CS8400, CS8401, CS8511, CS8627, CS8630, CS8652, CS8703,
CS8704, CS8706, CS8773, CS8912, CS8919, CS8929, CS8936, CS8957, CS8967, CS9014, CS9015, CS9016, CS9017, CS9058, CS9064,
CS9103, CS9171, CS9194, CS9202, CS9204, CS9240
CS9103, CS9171, CS9194, CS9202, CS9204, CS9240, CS9260
- name: Assembly references
href: ./compiler-messages/assembly-references.md
displayName: >
Expand All @@ -463,12 +463,12 @@ items:
CS7084, CS8166, CS8167, CS8168, CS8169. CS8325, CS8326, CS8327, CS8329, CS8330, CS8331, CS8332, CS8337, CS8338, CS8351,
CS8373, CS8374, CS8388, CS8977, CS9072, CS9077, CS9078, CS9079, CS9085, CS9086, CS9087, CS9089, CS9091, CS9092, CS9093,
CS9094, CS9095, CS9096, CS9097, CS9101, CS9102, CS9104, CS9190, CS9191, CS9192, CS9193, CS9195, CS9196, CS9197, CS9198,
CS9199, CS9200, CS9201
CS9199, CS9200, CS9201, CS9265
- name: "`ref struct` types"
href: ./compiler-messages/ref-struct-errors.md
displayName: >
ref struct,
CS8343, CS8344, CS8345, CS9048, CS9050, CS9059, CS9241, CS9242, CS9243, CS9244, CS9245, CS9246, CS9247
CS8343, CS8344, CS8345, CS9048, CS9050, CS9059, CS9241, CS9242, CS9243, CS9244, CS9245, CS9246, CS9247, CS9267
- name: Iterator methods
href: ./compiler-messages/iterator-yield.md
displayName: >
Expand Down Expand Up @@ -503,7 +503,7 @@ items:
CS9188, CS9203, CS9208, CS9209, CS9210
- name: Inline arrays
href: ./compiler-messages/inline-array-errors.md
displayName: CS9164, CS9165, CS9166, CS9167, CS9168, CS9169, CS9172, CS9173, CS9180, CS9181, CS9182, CS9183, CS9184
displayName: CS9164, CS9165, CS9166, CS9167, CS9168, CS9169, CS9172, CS9173, CS9180, CS9181, CS9182, CS9183, CS9184, CS9259
- name: Lambda expressions
href: ./compiler-messages/lambda-expression-errors.md
displayName: >
Expand Down
18 changes: 6 additions & 12 deletions docs/csharp/misc/cs0077.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ However, using [pattern matching](../fundamentals/functional/pattern-matching.md
```csharp
// CS0077.cs
using System;

class C
{
}


struct S
{
}
Expand All @@ -34,17 +30,15 @@ class M
{
public static void Main()
{
object o1, o2;
C c;
object o;
S s;

o = new S();

o1 = new C();
o2 = new S();

s = o2 as S; // CS0077, S is not a reference type
s = o as S; // CS0077, S is not a reference type

// Use pattern matching instead of as
if (o2 is S sValue)
if (o is S sValue)
{
s = sValue;
}
Expand Down
6 changes: 3 additions & 3 deletions docs/csharp/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,19 @@ items:
- name: C# 13
displayName: what's New
href: whats-new/csharp-13.md
- name: Breaking changes in C# 13
- name: Breaking changes since C# 12
href: ../../_roslyn/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20DotNet%209.md
- name: C# 12
displayName: what's New
href: whats-new/csharp-12.md
- name: Breaking changes in C# 12
- name: Breaking changes since C# 11
href: ../../_roslyn/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20DotNet%208.md
- name: C# 11
items:
- name: New features
displayName: what's new
href: whats-new/csharp-11.md
- name: Breaking changes in C# 11
- name: Breaking changes since C# 10
href: ../../_roslyn/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20DotNet%207.md
- name: C# 10
href: whats-new/csharp-10.md
Expand Down
4 changes: 2 additions & 2 deletions docs/fsharp/whats-new/fsharp-9.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ Example:
type Foo() =
member val X : int = 0 with get, set

[&ltExtension>]
[<Extension>]
type FooExt =
[&ltExtension>]
[<Extension>]
static member X (f: Foo, i: int) = f.X <- i; f

let f = Foo()
Expand Down
Loading