From 28797fc12ccc95efc7a3bebe22a74f3cf60995b5 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 6 Nov 2025 05:29:10 -0800 Subject: [PATCH 01/38] update class library overview doc (#49636) --- docs/csharp/fundamentals/types/index.md | 10 +- .../dataset-datatable-dataview/datatables.md | 94 +++++++------- .../blittable-and-non-blittable-types.md | 48 +++----- docs/fundamentals/toc.yml | 2 +- docs/standard/class-library-overview.md | 116 +++++------------- docs/standard/runtime-libraries-overview.md | 24 ++-- ...t-framework-file-io-and-the-file-system.md | 95 +++++++------- .../net-framework-reference-information.md | 34 ++--- 8 files changed, 179 insertions(+), 244 deletions(-) diff --git a/docs/csharp/fundamentals/types/index.md b/docs/csharp/fundamentals/types/index.md index 381a615c2adb3..209be162b385e 100644 --- a/docs/csharp/fundamentals/types/index.md +++ b/docs/csharp/fundamentals/types/index.md @@ -54,7 +54,7 @@ C# provides a standard set of built-in types. These represent integers, floating ## Custom types -You use the [`struct`](../../language-reference/builtin-types/struct.md), [`class`](../../language-reference/keywords/class.md), [`interface`](../../language-reference/keywords/interface.md), [`enum`](../../language-reference/builtin-types/enum.md), and [`record`](../../language-reference/builtin-types/record.md) constructs to create your own custom types. The .NET class library itself is a collection of custom types that you can use in your own applications. By default, the most frequently used types in the class library are available in any C# program. Others become available only when you explicitly add a project reference to the assembly that defines them. After the compiler has a reference to the assembly, you can declare variables (and constants) of the types declared in that assembly in source code. For more information, see [.NET Class Library](../../../standard/class-library-overview.md). +You use the [`struct`](../../language-reference/builtin-types/struct.md), [`class`](../../language-reference/keywords/class.md), [`interface`](../../language-reference/keywords/interface.md), [`enum`](../../language-reference/builtin-types/enum.md), and [`record`](../../language-reference/builtin-types/record.md) constructs to create your own custom types. The .NET class library itself is a collection of custom types that you can use in your own applications. By default, the most frequently used types in the class library are available in any C# program. Others become available only when you explicitly add a project reference to the assembly that defines them. After the compiler has a reference to the assembly, you can declare variables (and constants) of the types declared in that assembly in source code. One of the first decisions you make when defining a type is deciding which construct to use for your type. The following list helps make that initial decision. There's overlap in the choices. In most scenarios, more than one option is a reasonable choice. @@ -82,14 +82,14 @@ The following illustration shows the relationship between value types and refere Classes and structs are two of the basic constructs of the common type system in .NET. Each is essentially a data structure that encapsulates a set of data and behaviors that belong together as a logical unit. The data and behaviors are the *members* of the class, struct, or record. The members include its methods, properties, events, and so on, as listed later in this article. -A class, struct, or record declaration is like a blueprint that is used to create instances or objects at run time. If you define a class, struct, or record named `Person`, `Person` is the name of the type. If you declare and initialize a variable `p` of type `Person`, `p` is said to be an object or instance of `Person`. Multiple instances of the same `Person` type can be created, and each instance can have different values in its properties and fields. - +A class, struct, or record declaration is like a blueprint that is used to create instances or objects at run time. If you define a class, struct, or record named `Person`, `Person` is the name of the type. If you declare and initialize a variable `p` of type `Person`, `p` is said to be an object or instance of `Person`. Multiple instances of the same `Person` type can be created, and each instance can have different values in its properties and fields. + A class is a reference type. When an object of the type is created, the variable to which the object is assigned holds only a reference to that memory. When the object reference is assigned to a new variable, the new variable refers to the original object. Changes made through one variable are reflected in the other variable because they both refer to the same data. - + A struct is a value type. When a struct is created, the variable to which the struct is assigned holds the struct's actual data. When the struct is assigned to a new variable, it's copied. The new variable and the original variable therefore contain two separate copies of the same data. Changes made to one copy don't affect the other copy. Record types can be either reference types (`record class`) or value types (`record struct`). Record types contain methods that support value-equality. - + In general, classes are used to model more complex behavior. Classes typically store data that is intended to be modified after a class object is created. Structs are best suited for small data structures. Structs typically store data that isn't intended to be modified after the struct is created. Record types are data structures with extra compiler synthesized members. Records typically store data that isn't intended to be modified after the object is created. ### Value types diff --git a/docs/framework/data/adonet/dataset-datatable-dataview/datatables.md b/docs/framework/data/adonet/dataset-datatable-dataview/datatables.md index f80d993d90e3c..888d0ab29de35 100644 --- a/docs/framework/data/adonet/dataset-datatable-dataview/datatables.md +++ b/docs/framework/data/adonet/dataset-datatable-dataview/datatables.md @@ -6,53 +6,53 @@ ms.assetid: 52ff0e32-3e5a-41de-9a3b-7b04ea52b83e --- # DataTables -A is made up of a collection of tables, relationships, and constraints. In ADO.NET, objects are used to represent the tables in a **DataSet**. A **DataTable** represents one table of in-memory relational data; the data is local to the .NET-based application in which it resides, but can be populated from a data source such as Microsoft SQL Server using a **DataAdapter** For more information, see [Populating a DataSet from a DataAdapter](../populating-a-dataset-from-a-dataadapter.md). - - The **DataTable** class is a member of the **System.Data** namespace within the .NET Framework class library. You can create and use a **DataTable** independently or as a member of a **DataSet**, and **DataTable** objects can also be used in conjunction with other .NET Framework objects, including the . You access the collection of tables in a **DataSet** through the **Tables** property of the **DataSet** object. - - The schema, or structure of a table is represented by columns and constraints. You define the schema of a **DataTable** using objects as well as and objects. The columns in a table can map to columns in a data source, contain calculated values from expressions, automatically increment their values, or contain primary key values. - - In addition to a schema, a **DataTable** must also have rows to contain and order data. The class represents the actual data contained in a table. You use the **DataRow** and its properties and methods to retrieve, evaluate, and manipulate the data in a table. As you access and change the data within a row, the **DataRow** object maintains both its current and original state. - - You can create parent-child relationships between tables using one or more related columns in the tables. You create a relationship between **DataTable** objects using a . **DataRelation** objects can then be used to return the related child or parent rows of a particular row. For more information, see [Adding DataRelations](adding-datarelations.md). - -## In This Section - - [Creating a DataTable](creating-a-datatable.md) - Explains how to create a **DataTable** and add it to a **DataSet**. - - [DataTable Schema Definition](datatable-schema-definition.md) - Provides information about creating and using **DataColumn** objects and constraints. - - [Manipulating Data in a DataTable](manipulating-data-in-a-datatable.md) - Explains how to add, modify, and delete data in a table. Explains how to use **DataTable** events to examine changes to data in the table. - - [Handling DataTable Events](handling-datatable-events.md) - Provides information about the events available for use with a **DataTable**, including events when column values are modified and rows are added or deleted. - -## Related Sections - - [ADO.NET](../index.md) - Describes the ADO.NET architecture and components, and how to use them to access existing data sources and manage application data. - - [DataSets, DataTables, and DataViews](index.md) - Provides information about the ADO.NET **DataSet** including how to create relationships between tables. - - - Provides reference information about the **Constraint** object. - - - Provides reference information about the **DataColumn** object. - - - Provides reference information about the **DataSet** object. - - - Provides reference information about the **DataTable** object. - - [Class Library Overview](../../../../standard/class-library-overview.md) - Provides an overview of the .NET Framework class library, including the **System** namespace as well as its second-level namespace, **System.Data**. - +A is made up of a collection of tables, relationships, and constraints. In ADO.NET, objects are used to represent the tables in a **DataSet**. A **DataTable** represents one table of in-memory relational data; the data is local to the .NET-based application in which it resides, but can be populated from a data source such as Microsoft SQL Server using a **DataAdapter** For more information, see [Populating a DataSet from a DataAdapter](../populating-a-dataset-from-a-dataadapter.md). + + The **DataTable** class is a member of the **System.Data** namespace within the .NET Framework class library. You can create and use a **DataTable** independently or as a member of a **DataSet**, and **DataTable** objects can also be used in conjunction with other .NET Framework objects, including the . You access the collection of tables in a **DataSet** through the **Tables** property of the **DataSet** object. + + The schema, or structure of a table is represented by columns and constraints. You define the schema of a **DataTable** using objects as well as and objects. The columns in a table can map to columns in a data source, contain calculated values from expressions, automatically increment their values, or contain primary key values. + + In addition to a schema, a **DataTable** must also have rows to contain and order data. The class represents the actual data contained in a table. You use the **DataRow** and its properties and methods to retrieve, evaluate, and manipulate the data in a table. As you access and change the data within a row, the **DataRow** object maintains both its current and original state. + + You can create parent-child relationships between tables using one or more related columns in the tables. You create a relationship between **DataTable** objects using a . **DataRelation** objects can then be used to return the related child or parent rows of a particular row. For more information, see [Adding DataRelations](adding-datarelations.md). + +## In This Section + + [Creating a DataTable](creating-a-datatable.md) + Explains how to create a **DataTable** and add it to a **DataSet**. + + [DataTable Schema Definition](datatable-schema-definition.md) + Provides information about creating and using **DataColumn** objects and constraints. + + [Manipulating Data in a DataTable](manipulating-data-in-a-datatable.md) + Explains how to add, modify, and delete data in a table. Explains how to use **DataTable** events to examine changes to data in the table. + + [Handling DataTable Events](handling-datatable-events.md) + Provides information about the events available for use with a **DataTable**, including events when column values are modified and rows are added or deleted. + +## Related Sections + + [ADO.NET](../index.md)\ + Describes the ADO.NET architecture and components, and how to use them to access existing data sources and manage application data. + + [DataSets, DataTables, and DataViews](index.md)\ + Provides information about the ADO.NET including how to create relationships between tables. + + \ + Provides reference information about the **Constraint** object. + + \ + Provides reference information about the **DataColumn** object. + + \ + Provides reference information about the **DataSet** object. + + \ + Provides reference information about the **DataTable** object. + + [Core .NET libraries overview](../../../../standard/class-library-overview.md)\ + Provides an overview of the .NET class library. + ## See also - [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/interop/blittable-and-non-blittable-types.md b/docs/framework/interop/blittable-and-non-blittable-types.md index ca2814a3c36ce..e9075328b0f1d 100644 --- a/docs/framework/interop/blittable-and-non-blittable-types.md +++ b/docs/framework/interop/blittable-and-non-blittable-types.md @@ -1,6 +1,6 @@ --- title: "Blittable and Non-Blittable Types" -description: Learn about blittable and non-blittable types. Blittable data types are commonly represented in managed and unmanaged memory and don't need special handling. +description: Learn about blittable and nonblittable types. Blittable data types are commonly represented in managed and unmanaged memory and don't need special handling. ms.date: "03/30/2017" helpviewer_keywords: - "interop marshalling, blittable types" @@ -9,62 +9,50 @@ ms.assetid: d03b050e-2916-49a0-99ba-f19316e5c1b3 --- # Blittable and Non-Blittable Types -Most data types have a common representation in both managed and unmanaged memory and do not require special handling by the interop marshaller. These types are called *blittable types* because they do not require conversion when they are passed between managed and unmanaged code. +Most data types have a common representation in both managed and unmanaged memory and don't require special handling by the interop marshaller. These types are called *blittable types* because they don't require conversion when they're passed between managed and unmanaged code. - Structures that are returned from platform invoke calls must be blittable types. Platform invoke does not support non-blittable structures as return types. + Structures that are returned from platform invoke calls must be blittable types. Platform invoke doesn't support nonblittable structures as return types. The following types from the namespace are blittable types: - - - - - - - - - - - - - - - - - - - - - - - The following complex types are also blittable types: - One-dimensional arrays of blittable primitive types, such as an array of integers. However, a type that contains a variable array of blittable types is not itself blittable. +- Formatted value types that contain only blittable types (and classes if they're marshalled as formatted types). For more information about formatted value types, see [Default marshalling for value types](default-marshalling-behavior.md#default-marshalling-for-value-types). -- Formatted value types that contain only blittable types (and classes if they are marshalled as formatted types). For more information about formatted value types, see [Default marshalling for value types](default-marshalling-behavior.md#default-marshalling-for-value-types). - - Object references are not blittable. This includes an array of references to objects that are blittable by themselves. For example, you can define a structure that is blittable, but you cannot define a blittable type that contains an array of references to those structures. + Object references aren't blittable. In addition, an array of references to objects that are blittable by themselves isn't blittable. For example, you can define a structure that's blittable, but you can't define a blittable type that contains an array of references to those structures. As an optimization, arrays of blittable primitive types and classes that contain only blittable members are [pinned](copying-and-pinning.md) instead of copied during marshalling. These types can appear to be marshalled as In/Out parameters when the caller and callee are in the same apartment. However, these types are actually marshalled as In parameters, and you must apply the and attributes if you want to marshal the argument as an In/Out parameter. - Some managed data types require a different representation in an unmanaged environment. These non-blittable data types must be converted into a form that can be marshalled. For example, managed strings are non-blittable types because they must be converted into string objects before they can be marshalled. + Some managed data types require a different representation in an unmanaged environment. These nonblittable data types must be converted into a form that can be marshalled. For example, managed strings are nonblittable types because they must be converted into string objects before they can be marshalled. - The following table lists non-blittable types from the namespace. [Delegates](default-marshalling-behavior.md#default-marshalling-for-delegates), which are data structures that refer to a static method or to a class instance, are also non-blittable. + The following table lists nonblittable types from the namespace. [Delegates](default-marshalling-behavior.md#default-marshalling-for-delegates), which are data structures that refer to a static method or to a class instance, are also nonblittable. -| Non-blittable type | Description | +| Nonblittable type | Description | |---------------------------------------------------|-----------------------------------------------| -|[System.Array](default-marshalling-for-arrays.md)|Converts to a C-style array or a `SAFEARRAY`.| -|[System.Boolean](/previous-versions/dotnet/netframework-4.0/t2t3725f(v=vs.100))|Converts to a 1, 2, or 4-byte value with `true` as 1 or -1.| -|[System.Char](/previous-versions/dotnet/netframework-4.0/6tyybbf2(v=vs.100))|Converts to a Unicode or ANSI character.| -|[System.Class](/previous-versions/dotnet/netframework-4.0/s0968xy8(v=vs.100))|Converts to a class interface.| -|[System.Object](default-marshalling-for-objects.md)|Converts to a variant or an interface.| -|[System.String](default-marshalling-for-strings.md)|Converts to a string terminating in a null reference or to a BSTR.| -|[System.ValueType](/previous-versions/dotnet/netframework-4.0/0t2cwe11(v=vs.100))|Converts to a structure with a fixed memory layout.| -|[T[]](default-marshalling-for-arrays.md)|Converts to a C-style array or a `SAFEARRAY`.| - -Class and object types are supported only by COM interop. For corresponding types in Visual Basic, C#, and C++, see the [Class Library Overview](../../standard/class-library-overview.md). +| [System.Array](default-marshalling-for-arrays.md) | Converts to a C-style array or a `SAFEARRAY`. | +| [System.Boolean](/previous-versions/dotnet/netframework-4.0/t2t3725f(v=vs.100)) | Converts to a 1, 2, or 4-byte value with `true` as 1 or -1. | +| [System.Char](/previous-versions/dotnet/netframework-4.0/6tyybbf2(v=vs.100)) | Converts to a Unicode or ANSI character. | +| [System.Class](/previous-versions/dotnet/netframework-4.0/s0968xy8(v=vs.100)) | Converts to a class interface. | +| [System.Object](default-marshalling-for-objects.md) | Converts to a variant or an interface. | +| [System.String](default-marshalling-for-strings.md) | Converts to a string terminating in a null reference or to a BSTR. | +| [System.ValueType](/previous-versions/dotnet/netframework-4.0/0t2cwe11(v=vs.100)) | Converts to a structure with a fixed memory layout. | +| [T[]](default-marshalling-for-arrays.md) | Converts to a C-style array or a `SAFEARRAY`. | + +Class and object types are supported only by COM interop. ## See also diff --git a/docs/fundamentals/toc.yml b/docs/fundamentals/toc.yml index 7b74f1965d772..5f6cb1b04327a 100644 --- a/docs/fundamentals/toc.yml +++ b/docs/fundamentals/toc.yml @@ -255,7 +255,7 @@ items: href: runtime-libraries/system-convert.md - name: Choose between anonymous and tuple types href: ../standard/base-types/choosing-between-anonymous-and-tuple.md - - name: Class library overview + - name: Core .NET libraries overview href: ../standard/class-library-overview.md - name: Supplemental API remarks items: diff --git a/docs/standard/class-library-overview.md b/docs/standard/class-library-overview.md index e00538be31682..9e34f12f75029 100644 --- a/docs/standard/class-library-overview.md +++ b/docs/standard/class-library-overview.md @@ -1,42 +1,9 @@ --- -title: .NET class library overview -description: Learn about the .NET class library. .NET APIs include classes, interfaces, delegates, and value types to provide access to system functionality. -ms.date: 04/22/2021 -helpviewer_keywords: - - "classes [.NET], library overview" - - ".NET, library overview" - - "class objects value type" - - "naming conventions [.NET]" - - "types, .NET" - - "user-defined types" - - "Visual Basic, data types" - - "data types [.NET], C++" - - "Visual C#, data types" - - "libraries, .NET" - - "data types [.NET], F#" - - "System namespace" - - "F#, data types" - - ".NET, class library" - - "type system [.NET]" - - "data types [.NET]" - - "value types" - - "data types [.NET], Visual Basic" - - "Common Language Specification" - - "namespaces [.NET]" - - "floating point value type" - - "class library [.NET]" - - "CLS" - - "logical value type" - - "built-in types" - - "namespaces [.NET], about namespaces" - - "Visual C++, data types" - - "members [.NET], type" - - "data types [.NET], C#" - - "integer value type" - - "base types, class library" -ms.assetid: 7e4c5921-955d-4b06-8709-101873acf157 +title: Overview of core .NET libraries +description: Learn about the core .NET libraries. .NET APIs include classes, interfaces, delegates, and value types to provide access to system functionality. +ms.date: 11/05/2025 --- -# .NET class library overview +# Core .NET libraries overview .NET APIs include classes, interfaces, delegates, and value types that expedite and optimize the development process and provide access to system functionality. To facilitate interoperability between languages, most .NET types are CLS-compliant and can therefore be used from any programming language whose compiler conforms to the common language specification (CLS). @@ -49,79 +16,58 @@ ms.assetid: 7e4c5921-955d-4b06-8709-101873acf157 - Invoke .NET security checks. - Provide data access, rich client-side GUI, and server-controlled, client-side GUI. -.NET provides a rich set of interfaces, as well as abstract and concrete (non-abstract) classes. You can use the concrete classes as-is or, in many cases, derive your own classes from them. To use the functionality of an interface, you can either create a class that implements the interface or derive a class from one of the .NET classes that implements the interface. +.NET provides a rich set of interfaces as well as abstract and concrete (non-abstract) classes. You can use the concrete classes as-is or, in many cases, derive your own classes from them. To use the functionality of an interface, you can either create a class that implements the interface or derive a class from one of the .NET classes that implements the interface. ## Naming conventions - .NET types use a dot syntax naming scheme that connotes a hierarchy. This technique groups related types into namespaces so they can be searched and referenced more easily. The first part of the full name—up to the rightmost dot—is the namespace name. The last part of the name is the type name. For example, `System.Collections.Generic.List` represents the `List` type, which belongs to the `System.Collections.Generic` namespace. The types in can be used to work with generic collections. + .NET types use a dot syntax naming scheme to represent a hierarchy. Related types are grouped into namespaces so they can be searched and referenced more easily. The first part of the full name is the namespace name. The last part of the name is the type or member name. For example, `System.Collections.Generic.List` represents the type, which belongs to the `System.Collections.Generic` namespace. The types in can be used to work with generic collections. - This naming scheme makes it easy for library developers extending .NET to create hierarchical groups of types and name them in a consistent, informative manner. It also allows types to be unambiguously identified by their full name (that is, by their namespace and type name), which prevents type name collisions. Library developers are expected to use the following convention when creating names for their namespaces: - - *CompanyName*.*TechnologyName* - - For example, the namespace `Microsoft.Word` conforms to this guideline. + This naming scheme makes it easy for library developers who extend .NET to create hierarchical groups of types and name them in a consistent, informative manner. It also allows types to be unambiguously identified by their full name (that is, by their namespace and type name), which prevents type name collisions. The use of naming patterns to group related types into namespaces is a useful way to build and document class libraries. However, this naming scheme has no effect on visibility, member access, inheritance, security, or binding. A namespace can be partitioned across multiple assemblies and a single assembly can contain types from multiple namespaces. The assembly provides the formal structure for versioning, deployment, security, loading, and visibility in the common language runtime. - For more information on namespaces and type names, see [Common Type System](base-types/common-type-system.md). + For more information on namespaces and type names, see [Common type system](base-types/common-type-system.md). ## System namespace - The namespace is the root namespace for fundamental types in .NET. This namespace includes classes that represent the base data types used by all applications, for example, (the root of the inheritance hierarchy), , , , , and . Many of these types correspond to the primitive data types that your programming language uses. When you write code using .NET types, you can use your language's corresponding keyword when a .NET base data type is expected. - - The following table lists the base types that .NET supplies, briefly describes each type, and indicates the corresponding type in Visual Basic, C#, C++, and F#. - -|Category|Class name|Description|Visual Basic data type|C# data type|C++/CLI data type|F# data type| -|--------------|----------------|-----------------|----------------------------|-------------------|---------------------|-----------------------| -|Integer||An 8-bit unsigned integer.|`Byte`|`byte`|`unsigned char`|`byte`| -|||An 8-bit signed integer.

Not CLS-compliant.|`SByte`|`sbyte`|`char` or `signed char`|`sbyte`| -|||A 16-bit signed integer.|`Short`|`short`|`short`|`int16`| -|||A 32-bit signed integer.|`Integer`|`int`|`int` or `long`|`int`| -|||A 64-bit signed integer.|`Long`|`long`|`__int64`|`int64`| -|||A 16-bit unsigned integer.

Not CLS-compliant.|`UShort`|`ushort`|`unsigned short`|`uint16`| -|||A 32-bit unsigned integer.

Not CLS-compliant.|`UInteger`|`uint`|`unsigned int` or `unsigned long`|`uint32`| -|||A 64-bit unsigned integer.

Not CLS-compliant.|`ULong`|`ulong`|`unsigned __int64`|`uint64`| -|Floating point||A half-precision (16-bit) floating-point number.||||| -|||A single-precision (32-bit) floating-point number.|`Single`|`float`|`float`|`float32` or `single`| -|||A double-precision (64-bit) floating-point number.|`Double`|`double`|`double`|`float` or `double`| -|Logical||A Boolean value (true or false).|`Boolean`|`bool`|`bool`|`bool`| -|Other||A Unicode (16-bit) character.|`Char`|`char`|`wchar_t`|`char`| -|||A decimal (128-bit) value.|`Decimal`|`decimal`|`Decimal`|`decimal`| -|||A signed integer whose size depends on the underlying platform (a 32-bit value on a 32-bit platform and a 64-bit value on a 64-bit platform).| |`nint`| |`unativeint`| -|||An unsigned integer whose size depends on the underlying platform (a 32- bit value on a 32-bit platform and a 64-bit value on a 64-bit platform).

Not CLS-compliant.| |`nuint`| |`unativeint`| -|||The root of the object hierarchy.|`Object`|`object`|`Object^`|`obj`| -|||An immutable, fixed-length string of Unicode characters.|`String`|`string`|`String^`|`string`| - -In addition to the base data types, the namespace contains over 100 classes, ranging from classes that handle exceptions to classes that deal with core runtime concepts, such as application domains and the garbage collector. The namespace also contains many second-level namespaces. - -For more information about namespaces, use the [.NET API Browser](../../api/index.md) to browse the .NET Class Library. The API reference documentation provides documentation on each namespace, its types, and each of their members. +The namespace is the root namespace for fundamental types in .NET. This namespace includes classes that represent the base data types used by all applications, for example, (the root of the inheritance hierarchy), , , , , and . + +Many of these types correspond to the primitive data types that a programming language uses. When you write code using .NET types, you can use the corresponding language keyword when a .NET base data type is expected. For more information, see: + +- [Built-in types (C# reference)](../csharp/language-reference/builtin-types/built-in-types.md) +- [Primitive types (Visual Basic)](/dotnet/visual-basic/reference/language-specification/types#primitive-types) +- [Basic types (F#)](../fsharp/language-reference/basic-types.md) + +In addition to the base data types, the namespace contains over 100 classes, ranging from classes that handle exceptions to classes that deal with core runtime concepts, such as garbage collection. The namespace also contains many second-level namespaces. + +The [.NET API reference documentation](../../api/index.md) provides documentation on each namespace, its types, and their members. ## Data structures .NET includes a set of data structures that are the workhorses of many .NET apps. These are mostly collections, but also include other types. -* - Represents an array of strongly typed objects that can be accessed by index. Has a fixed size, per its construction. -* - Represents a strongly typed list of objects that can be accessed by index. Is automatically resized as needed. -* - Represents a collection of values that are indexed by a key. Values can be accessed via key. Is automatically resized as needed. -* - Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI. -* - Represents an instant in time, typically expressed as a date and time of day. +- - Represents an array of strongly typed objects that can be accessed by index. Has a fixed size, per its construction. +- - Represents a strongly typed list of objects that can be accessed by index. Is automatically resized as needed. +- - Represents a collection of values that are indexed by a key. Values can be accessed via key. Is automatically resized as needed. +- - Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI. +- - Represents an instant in time, typically expressed as a date and time of day. ## Utility APIs .NET includes a set of utility APIs that provide functionality for many important tasks. -* - An API for sending HTTP requests and receiving HTTP responses from a resource identified by a URI. -* - An API for loading and querying XML documents with LINQ. -* - An API for reading files. -* - An API for writing files. +- - An API for sending HTTP requests and receiving HTTP responses from a resource identified by a URI. +- and : An API for writing logging and debugging information during application execution. +- and - APIs for reading and writing files. +- - An API for serializing objects or value types to JSON and deserializing JSON into objects or value types. ## App-model APIs There are many app models that can be used with .NET, for example: -* [ASP.NET](https://dotnet.microsoft.com/apps/aspnet) - A web framework for building web sites and services. Supported on Windows, Linux, and macOS (depends on ASP.NET version). -* [.NET MAUI](https://dotnet.microsoft.com/apps/maui) - An app platform for building native apps that run on Windows, macOS, iOS, and Android using C#. -* [Windows Desktop](https://www.nuget.org/packages/Microsoft.WindowsDesktop.App.Ref/) - Includes Windows Presentation Foundation (WPF) and Windows Forms. +- [ASP.NET Core](https://dotnet.microsoft.com/apps/aspnet) - A web framework for building web sites and services. Supported on Windows, Linux, and macOS. +- [.NET MAUI](https://dotnet.microsoft.com/apps/maui) - An app platform for building native apps that run on Windows, macOS, iOS, and Android using C#. +- [Windows Desktop](https://www.nuget.org/packages/Microsoft.WindowsDesktop.App.Ref/) - Includes Windows Presentation Foundation (WPF) and Windows Forms. ## See also diff --git a/docs/standard/runtime-libraries-overview.md b/docs/standard/runtime-libraries-overview.md index 1230de6cbc559..42b69d05b4c2b 100644 --- a/docs/standard/runtime-libraries-overview.md +++ b/docs/standard/runtime-libraries-overview.md @@ -1,7 +1,7 @@ --- title: Runtime libraries overview description: Learn what is included in the Runtime libraries section of the table of contents. -ms.date: 05/30/2024 +ms.date: 11/05/2025 --- # Runtime libraries overview @@ -19,16 +19,18 @@ Some libraries are provided in NuGet packages rather than as part of the runtime The following table shows some examples of package-provided libraries. -| NuGet package | Conceptual content | -|-------------------------------------------------------|--------------------------------------------------------------------| -| [`Microsoft.Extensions.Configuration`][configuration] | [Configuration](../core/extensions/configuration.md) | -| [`Microsoft.Extensions.DependencyInjection`][di] | [Dependency injection](../core/extensions/dependency-injection.md) | -| [`Microsoft.Extensions.FileSystemGlobbing`][fsg] | [File globbing](../core/extensions/file-globbing.md) | -| [`Microsoft.Extensions.Hosting`][host] | [Generic Host](../core/extensions/generic-host.md) | -| [`Microsoft.Extensions.Http`][http] | [HTTP](../core/extensions/httpclient-factory.md) | -| [`Microsoft.Extensions.Localization`][loc] | [Localization](../core/extensions/localization.md) | -| [`Microsoft.Extensions.Logging`][log] | [Logging](../core/extensions/logging.md) | - +| NuGet package | Conceptual content | +|---------------------------------|----------------------------------------| +| [`Microsoft.Extensions.AI`][ai] | [AI](../ai/microsoft-extensions-ai.md) | +| [`Microsoft.Extensions.Configuration`][configuration] | [Configuration](../core/extensions/configuration.md) | +| [`Microsoft.Extensions.DependencyInjection`][di] | [Dependency injection](../core/extensions/dependency-injection.md) | +| [`Microsoft.Extensions.FileSystemGlobbing`][fsg] | [File globbing](../core/extensions/file-globbing.md) | +| [`Microsoft.Extensions.Hosting`][host] | [Generic Host](../core/extensions/generic-host.md) | +| [`Microsoft.Extensions.Http`][http] | [HTTP](../core/extensions/httpclient-factory.md) | +| [`Microsoft.Extensions.Localization`][loc] | [Localization](../core/extensions/localization.md) | +| [`Microsoft.Extensions.Logging`][log] | [Logging](../core/extensions/logging.md) | + +[ai]: https://www.nuget.org/packages/Microsoft.Extensions.AI [configuration]: https://www.nuget.org/packages/Microsoft.Extensions.Configuration [di]: https://www.nuget.org/packages/Microsoft.Extensions.DependencyInjection [fsg]: https://www.nuget.org/packages/Microsoft.Extensions.FileSystemGlobbing diff --git a/docs/visual-basic/developing-apps/programming/drives-directories-files/classes-used-in-net-framework-file-io-and-the-file-system.md b/docs/visual-basic/developing-apps/programming/drives-directories-files/classes-used-in-net-framework-file-io-and-the-file-system.md index 20c007be36897..090f8a47ad0b9 100644 --- a/docs/visual-basic/developing-apps/programming/drives-directories-files/classes-used-in-net-framework-file-io-and-the-file-system.md +++ b/docs/visual-basic/developing-apps/programming/drives-directories-files/classes-used-in-net-framework-file-io-and-the-file-system.md @@ -2,62 +2,61 @@ description: "Learn more about: Classes Used in .NET Framework File I/O and the File System (Visual Basic)" title: "Classes Used in .NET Framework File I/O and the File System" ms.date: 07/20/2015 -helpviewer_keywords: +helpviewer_keywords: - "file I/O classes" ms.assetid: 4a5ca924-eea8-4a95-a5f0-6ac10de276a3 --- # Classes Used in .NET Framework File I/O and the File System (Visual Basic) -The following tables list the classes commonly used for .NET Framework file I/O, categorized into file I/O classes, classes used for creating streams, and classes used to read and write to streams. - -For a more comprehensive listing, see [Class Library Overview](../../../../standard/class-library-overview.md). - -## Basic I/O Classes for Files, Drives, and Directories - - The following table lists and describes the main classes used for file I/O. - -|Class|Description| -|-----------|-----------------| -||Provides static methods for creating, moving, and enumerating through directories and subdirectories.| -||Provides instance methods for creating, moving, and enumerating through directories and subdirectories.| -||Provides instance methods for creating, moving, and enumerating through drives.| -||Provides static methods for creating, copying, deleting, moving, and opening files, and aids in the creation of a `FileStream`.| -||Defines constants for read, write, or read/write access to a file.| -||Provides attributes for files and directories such as `Archive`, `Hidden`, and `ReadOnly`.| -||Provides static methods for creating, copying, deleting, moving, and opening files, and aids in the creation of a `FileStream`.| -||Controls how a file is opened. This parameter is specified in many of the constructors for `FileStream` and `IsolatedStorageFileStream`, and for the `Open` methods of and .| -||Defines constants for controlling the type of access other file streams can have to the same file.| -||Provides methods and properties for processing directory strings.| -||Controls the access of files and folders by defining , , and permissions.| - -## Classes Used to Create Streams - - The following table lists and describes the main classes used to create streams. - -|Class|Description| -|-----------|-----------------| -||Adds a buffering layer to read and write operations on another stream.| -||Supports random access to files through its method. opens files synchronously by default but also supports asynchronous operation.| -||Creates a stream whose backing store is memory, rather than a file.| -||Provides the underlying stream of data for network access.| -||Defines a stream that links data streams to cryptographic transformations.| - -## Classes Used to Read from and Write to Streams - - The following table shows the specific classes used for reading from and writing to files with streams. - -|**Class**|**Description**| -|---------------|---------------------| -||Reads encoded strings and primitive data types from a .| -||Writes encoded strings and primitive data types to a .| -||Reads characters from a , using to convert characters to and from bytes. has a constructor that attempts to ascertain the correct for a given stream, based on the presence of a -specific preamble, such as a byte order mark.| -||Writes characters to a `FileStream`, using to convert characters to bytes.| -||Reads characters from a `String`. Output can be either a stream in any encoding or a `String`.| -||Writes characters to a `String`. Output can be either a stream in any encoding or a `String`.| - +The following tables list the classes commonly used for .NET Framework file I/O, categorized into file I/O classes, classes used for creating streams, and classes used to read and write to streams. + +## Basic I/O Classes for Files, Drives, and Directories + + The following table lists and describes the main classes used for file I/O. + +|Class|Description| +|-----------|-----------------| +||Provides static methods for creating, moving, and enumerating through directories and subdirectories.| +||Provides instance methods for creating, moving, and enumerating through directories and subdirectories.| +||Provides instance methods for creating, moving, and enumerating through drives.| +||Provides static methods for creating, copying, deleting, moving, and opening files, and aids in the creation of a `FileStream`.| +||Defines constants for read, write, or read/write access to a file.| +||Provides attributes for files and directories such as `Archive`, `Hidden`, and `ReadOnly`.| +||Provides static methods for creating, copying, deleting, moving, and opening files, and aids in the creation of a `FileStream`.| +||Controls how a file is opened. This parameter is specified in many of the constructors for `FileStream` and `IsolatedStorageFileStream`, and for the `Open` methods of and .| +||Defines constants for controlling the type of access other file streams can have to the same file.| +||Provides methods and properties for processing directory strings.| +||Controls the access of files and folders by defining , , and permissions.| + +## Classes Used to Create Streams + + The following table lists and describes the main classes used to create streams. + +|Class|Description| +|-----------|-----------------| +||Adds a buffering layer to read and write operations on another stream.| +||Supports random access to files through its method. opens files synchronously by default but also supports asynchronous operation.| +||Creates a stream whose backing store is memory, rather than a file.| +||Provides the underlying stream of data for network access.| +||Defines a stream that links data streams to cryptographic transformations.| + +## Classes Used to Read from and Write to Streams + + The following table shows the specific classes used for reading from and writing to files with streams. + +|**Class**|**Description**| +|---------------|---------------------| +||Reads encoded strings and primitive data types from a .| +||Writes encoded strings and primitive data types to a .| +||Reads characters from a , using to convert characters to and from bytes. has a constructor that attempts to ascertain the correct for a given stream, based on the presence of a -specific preamble, such as a byte order mark.| +||Writes characters to a `FileStream`, using to convert characters to bytes.| +||Reads characters from a `String`. Output can be either a stream in any encoding or a `String`.| +||Writes characters to a `String`. Output can be either a stream in any encoding or a `String`.| + ## See also - [Composing Streams](../../../../standard/io/composing-streams.md) - [File and Stream I/O](../../../../standard/io/index.md) - [Asynchronous File I/O](../../../../standard/io/asynchronous-file-i-o.md) - [Basics of .NET Framework File I/O and the File System (Visual Basic)](basics-of-net-framework-file-io-and-the-file-system.md) +- [Core .NET libraries overview](../../../../standard/class-library-overview.md) diff --git a/docs/visual-basic/reference/net-framework-reference-information.md b/docs/visual-basic/reference/net-framework-reference-information.md index bd46906deb022..88b50a81a39b5 100644 --- a/docs/visual-basic/reference/net-framework-reference-information.md +++ b/docs/visual-basic/reference/net-framework-reference-information.md @@ -2,7 +2,7 @@ description: "Learn more about: .NET Framework Reference Information (Visual Basic)" title: ".NET Framework Reference Information" ms.date: 07/20/2015 -helpviewer_keywords: +helpviewer_keywords: - "language reference [Visual Basic], .NET Framework" - ".NET Framework [Visual Basic], reference" - ".NET Framework class library [Visual Basic], reference information" @@ -10,21 +10,21 @@ ms.assetid: 8b202505-608b-4223-bbd9-2ace3d73e6cd --- # .NET Framework Reference Information (Visual Basic) -This topic provides links to information about how to work with the .NET Framework class library. - -## Related Sections +This topic provides links to information about how to work with the .NET Framework class library. - [Getting Started](../../framework/get-started/index.md) - Provides a comprehensive overview of the .NET Framework and links to additional resources. - - [Class Library Overview](../../standard/class-library-overview.md) - Introduces the classes, interfaces, and value types that help expedite and optimize the development process and provide access to system functionality. - - [Development Guide](../../framework/development-guide.md) - Provides a guide to all key technology areas and tasks for application development, including creating, configuring, debugging, securing, and deploying your application. This topic also provides information about dynamic programming, interoperability, extensibility, memory management, and threading. - - [Tools](../../framework/tools/index.md) - Describes the tools that you can use to develop, configure, and deploy applications by using .NET Framework technologies. - - [.NET API Browser](../../../api/index.md) +## Related Sections + + [Getting Started](../../framework/get-started/index.md)\ + Provides a comprehensive overview of the .NET Framework and links to additional resources. + + [Core .NET Libraries Overview](../../standard/class-library-overview.md)\ + Introduces the classes, interfaces, and value types that help expedite and optimize the development process and provide access to system functionality. + + [Development Guide](../../framework/development-guide.md)\ + Provides a guide to all key technology areas and tasks for application development, including creating, configuring, debugging, securing, and deploying your application. This topic also provides information about dynamic programming, interoperability, extensibility, memory management, and threading. + + [Tools](../../framework/tools/index.md)\ + Describes the tools that you can use to develop, configure, and deploy applications by using .NET Framework technologies. + + [.NET API Browser](../../../api/index.md)\ Provides syntax, code examples, and related information for each class in the .NET Framework namespaces. From d7c856040d55fbfd1e3182e8a6490feff8e828dd Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 6 Nov 2025 05:43:46 -0800 Subject: [PATCH 02/38] Update package index with latest published versions (#49639) * Update package index with latest published versions * Update docs/azure/includes/dotnet-all.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Bill Wagner Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/azure/includes/dotnet-all.md | 3 ++- docs/azure/includes/dotnet-new.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 3e23f0a436ee0..66b8f34a63222 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -210,7 +210,7 @@ | Resource Management - Container Apps | NuGet [1.5.0](https://www.nuget.org/packages/Azure.ResourceManager.AppContainers/1.5.0) | [docs](/dotnet/api/overview/azure/ResourceManager.AppContainers-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.AppContainers_1.5.0/sdk/containerapps/Azure.ResourceManager.AppContainers/) | | Resource Management - Container Instances | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerInstance/1.3.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerInstance-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerInstance_1.3.0/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/) | | Resource Management - Container Orchestrator Runtime | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerOrchestratorRuntime/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerOrchestratorRuntime-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerOrchestratorRuntime_1.0.0-beta.1/sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime/) | -| Resource Management - Container Registry | NuGet [1.3.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.3.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerRegistry-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.3.1/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/) | +| Resource Management - Container Registry | NuGet [1.4.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.4.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerRegistry-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.4.0/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/) | | Resource Management - Container Service | NuGet [1.2.5](https://www.nuget.org/packages/Azure.ResourceManager.ContainerService/1.2.5) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerService-readme) | GitHub [1.2.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerService_1.2.5/sdk/containerservice/Azure.ResourceManager.ContainerService/) | | Resource Management - Container Service Fleet | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerServiceFleet/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerServiceFleet/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerServiceFleet-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerServiceFleet_1.1.0/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerServiceFleet_1.2.0-beta.1/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/) | | Resource Management - Content Delivery Network | NuGet [1.5.0](https://www.nuget.org/packages/Azure.ResourceManager.Cdn/1.5.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Cdn-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Cdn_1.5.0/sdk/cdn/Azure.ResourceManager.Cdn/) | @@ -416,6 +416,7 @@ | Speech Extension Telemetry | NuGet [1.46.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Telemetry/1.46.0) | | | | System Net Client Model | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/System.Net.ClientModel/1.0.0-beta.1) | | | | Unknown Display Name | NuGet [0.13.0](https://www.nuget.org/packages/Azure.Iot.Operations.Connector/0.13.0) | | | +| IoT Operations Templates | NuGet [0.1.0](https://www.nuget.org/packages/Azure.Iot.Operations.Templates/0.1.0) | | | | Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp/2.0.0-beta.1) | | | | Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/2.0.0-beta.1) | | | | Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-x64/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp.linux-x64/2.0.0-beta.1) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 3c45a559e6eb5..6dde981fad4a5 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -221,7 +221,7 @@ | Resource Management - Container Apps | NuGet [1.5.0](https://www.nuget.org/packages/Azure.ResourceManager.AppContainers/1.5.0) | [docs](/dotnet/api/overview/azure/ResourceManager.AppContainers-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.AppContainers_1.5.0/sdk/containerapps/Azure.ResourceManager.AppContainers/) | | Resource Management - Container Instances | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerInstance/1.3.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerInstance-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerInstance_1.3.0/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/) | | Resource Management - Container Orchestrator Runtime | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerOrchestratorRuntime/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerOrchestratorRuntime-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerOrchestratorRuntime_1.0.0-beta.1/sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime/) | -| Resource Management - Container Registry | NuGet [1.3.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.3.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerRegistry-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.3.1/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/) | +| Resource Management - Container Registry | NuGet [1.4.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerRegistry/1.4.0) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerRegistry-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerRegistry_1.4.0/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/) | | Resource Management - Container Service | NuGet [1.2.5](https://www.nuget.org/packages/Azure.ResourceManager.ContainerService/1.2.5) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerService-readme) | GitHub [1.2.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerService_1.2.5/sdk/containerservice/Azure.ResourceManager.ContainerService/) | | Resource Management - Container Service Fleet | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.ContainerServiceFleet/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.ContainerServiceFleet/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.ContainerServiceFleet-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerServiceFleet_1.1.0/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ContainerServiceFleet_1.2.0-beta.1/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/) | | Resource Management - Content Delivery Network | NuGet [1.5.0](https://www.nuget.org/packages/Azure.ResourceManager.Cdn/1.5.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Cdn-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Cdn_1.5.0/sdk/cdn/Azure.ResourceManager.Cdn/) | From 6c4d329a31d37aa71a9b8862807a49dd6daabb4a Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 07:57:10 -0800 Subject: [PATCH 03/38] Document breaking change: Double quotes disallowed in file-level directives (#49608) --- docs/core/compatibility/10.0.md | 1 + .../file-level-directive-double-quotes.md | 41 +++++++++++++++++++ docs/core/compatibility/toc.yml | 2 + 3 files changed, 44 insertions(+) create mode 100644 docs/core/compatibility/sdk/10.0/file-level-directive-double-quotes.md diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index 6cba46b248d87..b5e54a5d9c0b8 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -119,6 +119,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af | [.NET tool packaging creates RuntimeIdentifier-specific tool packages](sdk/10.0/dotnet-tool-pack-publish.md) | Behavioral change | Preview 6 | | [Default workload configuration from 'loose manifests' to 'workload sets' mode](sdk/10.0/default-workload-config.md) | Behavioral change | Preview 2 | | [dnx.ps1 file is no longer included in .NET SDK](sdk/10.0/dnx-ps1-removed.md) | Source incompatible | GA | +| [Double quotes in file-level directives are disallowed](sdk/10.0/file-level-directive-double-quotes.md) | Source incompatible | GA | | [`dotnet new sln` defaults to SLNX file format](sdk/10.0/dotnet-new-sln-slnx-default.md) | Behavioral change | RC 1 | | [`dotnet package list` performs restore](sdk/10.0/dotnet-package-list-restore.md) | Behavioral change | Preview 4 | | [`dotnet restore` audits transitive packages](sdk/10.0/nugetaudit-transitive-packages.md) | Behavioral change | Preview 3 | diff --git a/docs/core/compatibility/sdk/10.0/file-level-directive-double-quotes.md b/docs/core/compatibility/sdk/10.0/file-level-directive-double-quotes.md new file mode 100644 index 0000000000000..c6f820f3c167c --- /dev/null +++ b/docs/core/compatibility/sdk/10.0/file-level-directive-double-quotes.md @@ -0,0 +1,41 @@ +--- +title: "Breaking change - Double quotes in file-level directives are disallowed" +description: "Learn about the breaking change in .NET 10 where double quotes in file-level directives are disallowed." +ms.date: 11/04/2025 +ai-usage: ai-assisted +ms.custom: https://github.com/dotnet/docs/issues/48916 +--- + +# Double quotes in file-level directives are disallowed + +Usage of double quotes `"` inside `#:` file-level directives is now a build-time error when running file-based apps (for example, `dotnet run app.cs`). + +## Version introduced + +.NET 10 GA + +## Previous behavior + +In .NET 10 RC2 and older .NET 10 previews, quotes in directives weren't blocked but they didn't work as expected. They were only escaped as any other special character and passed to MSBuild. For example, `#:property Prop="my test"` resulted in `"my test"`. + +## New behavior + +An error is reported if a double quote `"` is encountered in any file-level directive. The error message is: + +> Directives currently cannot contain double quotes ("). + +## Type of breaking change + +This change can affect [source compatibility](../../categories.md#source-compatibility). + +## Reason for change + +This change enables future support for quoted directives without introducing a breaking change. This also improves the error recovery experience if users try to use quotes now, thinking that's supported syntax. + +## Recommended action + +Don't use quotes in `#:` directives. If you really need to use a double quote (or another special character that currently isn't supported, like trailing whitespace), move the corresponding project metadata entry into a `Directory.Build.props` file instead (it will be picked up by the file-based app). Or, convert the file-based app to a full project via `dotnet project convert`. + +## Affected APIs + +None. diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index cdd46b00d6fe3..047ad3a288742 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -134,6 +134,8 @@ items: href: sdk/10.0/dotnet-tool-pack-publish.md - name: dnx.ps1 file is no longer included in .NET SDK href: sdk/10.0/dnx-ps1-removed.md + - name: Double quotes in file-level directives are disallowed + href: sdk/10.0/file-level-directive-double-quotes.md - name: "`dotnet restore` audits transitive packages" href: sdk/10.0/nugetaudit-transitive-packages.md - name: project.json not supported in `dotnet restore` From 93ab90ad806d993e424488239dbe0943792d2ee7 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 6 Nov 2025 08:47:25 -0800 Subject: [PATCH 04/38] Update package index with latest published versions (#49652) --- docs/azure/includes/dotnet-all.md | 4 ++-- docs/azure/includes/dotnet-new.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 66b8f34a63222..716b318b12440 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -141,7 +141,7 @@ | Functions extension for WebPubSub for SocketIO | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.WebPubSubForSocketIO/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.WebPubSubForSocketIO-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.WebPubSubForSocketIO_1.0.0-beta.4/sdk/webpubsub/Microsoft.Azure.WebJobs.Extensions.WebPubSubForSocketIO/) | | Provisioning - App Configuration | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.AppConfiguration/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.AppConfiguration-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppConfiguration_1.1.0/sdk/provisioning/Azure.Provisioning.AppConfiguration/) | | Provisioning - App Containers | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.AppContainers/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.AppContainers-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppContainers_1.1.0/sdk/provisioning/Azure.Provisioning.AppContainers/) | -| Provisioning - App Service | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.2.0) | [docs](/dotnet/api/overview/azure/Provisioning.AppService-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.2.0/sdk/provisioning/Azure.Provisioning.AppService/) | +| Provisioning - App Service | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.2.0)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.AppService-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.2.0/sdk/provisioning/Azure.Provisioning.AppService/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.3.0-beta.1/sdk/provisioning/Azure.Provisioning.AppService/) | | Provisioning - Application Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.ApplicationInsights/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.ApplicationInsights-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApplicationInsights_1.1.0/sdk/provisioning/Azure.Provisioning.ApplicationInsights/) | | Provisioning - Cognitive Services | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.CognitiveServices/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.CognitiveServices-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CognitiveServices_1.1.0/sdk/provisioning/Azure.Provisioning.CognitiveServices/) | | Provisioning - Communication | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Provisioning.Communication/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Provisioning.Communication-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Communication_1.0.0-beta.3/sdk/provisioning/Azure.Provisioning.Communication/) | @@ -416,7 +416,7 @@ | Speech Extension Telemetry | NuGet [1.46.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Telemetry/1.46.0) | | | | System Net Client Model | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/System.Net.ClientModel/1.0.0-beta.1) | | | | Unknown Display Name | NuGet [0.13.0](https://www.nuget.org/packages/Azure.Iot.Operations.Connector/0.13.0) | | | -| IoT Operations Templates | NuGet [0.1.0](https://www.nuget.org/packages/Azure.Iot.Operations.Templates/0.1.0) | | | +| Unknown Display Name | NuGet [0.1.0](https://www.nuget.org/packages/Azure.Iot.Operations.Templates/0.1.0) | | | | Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp/2.0.0-beta.1) | | | | Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/2.0.0-beta.1) | | | | Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-x64/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp.linux-x64/2.0.0-beta.1) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 6dde981fad4a5..68db1b766a7df 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -150,7 +150,7 @@ | Functions extension for WebPubSub for SocketIO | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.WebPubSubForSocketIO/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.WebPubSubForSocketIO-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.WebPubSubForSocketIO_1.0.0-beta.4/sdk/webpubsub/Microsoft.Azure.WebJobs.Extensions.WebPubSubForSocketIO/) | | Provisioning - App Configuration | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.AppConfiguration/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.AppConfiguration-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppConfiguration_1.1.0/sdk/provisioning/Azure.Provisioning.AppConfiguration/) | | Provisioning - App Containers | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.AppContainers/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.AppContainers-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppContainers_1.1.0/sdk/provisioning/Azure.Provisioning.AppContainers/) | -| Provisioning - App Service | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.2.0) | [docs](/dotnet/api/overview/azure/Provisioning.AppService-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.2.0/sdk/provisioning/Azure.Provisioning.AppService/) | +| Provisioning - App Service | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.2.0)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.AppService-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.2.0/sdk/provisioning/Azure.Provisioning.AppService/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.3.0-beta.1/sdk/provisioning/Azure.Provisioning.AppService/) | | Provisioning - Application Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.ApplicationInsights/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.ApplicationInsights-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApplicationInsights_1.1.0/sdk/provisioning/Azure.Provisioning.ApplicationInsights/) | | Provisioning - Cognitive Services | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.CognitiveServices/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.CognitiveServices-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CognitiveServices_1.1.0/sdk/provisioning/Azure.Provisioning.CognitiveServices/) | | Provisioning - Communication | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Provisioning.Communication/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Provisioning.Communication-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Communication_1.0.0-beta.3/sdk/provisioning/Azure.Provisioning.Communication/) | From 6e6b9ec43a8bf46f1611b39ea307880d942739e9 Mon Sep 17 00:00:00 2001 From: thecoolone <35124383+snehansh@users.noreply.github.com> Date: Thu, 6 Nov 2025 22:20:16 +0530 Subject: [PATCH 05/38] Fix reference to IsPrime method in unit testing docs (#49648) Corrected the reference to the method in the PrimeService.cs file for clarity. --- docs/core/testing/unit-testing-csharp-with-nunit.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/testing/unit-testing-csharp-with-nunit.md b/docs/core/testing/unit-testing-csharp-with-nunit.md index 5f35fd312de4c..8e5e995eaf354 100644 --- a/docs/core/testing/unit-testing-csharp-with-nunit.md +++ b/docs/core/testing/unit-testing-csharp-with-nunit.md @@ -176,7 +176,7 @@ Instead of creating new tests, apply this attribute to create a single data-driv [!code-csharp[Sample_TestCode](~/samples/snippets/core/testing/unit-testing-using-nunit/csharp/PrimeService.Tests/PrimeService_IsPrimeShould.cs?name=Sample_TestCode)] -Run `dotnet test`, and two of these tests fail. To make all of the tests pass, change the `if` clause at the beginning of the `Main` method in the *PrimeService.cs* file: +Run `dotnet test`, and two of these tests fail. To make all of the tests pass, change the `if` clause at the beginning of the `IsPrime` method in the *PrimeService.cs* file: ```csharp if (candidate < 2) From a4168690a9731b98e87893158e685f30bda1ae6d Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 17:16:55 +0000 Subject: [PATCH 06/38] Document missing vs. null value behavior in RespectNullableAnnotations (#49378) --- .../system-text-json/nullable-annotations.md | 18 +++++++++++++++- .../snippets/nullable-annotations/Nullable.cs | 21 +++++++++++++++++++ .../snippets/nullable-annotations/Program.cs | 3 ++- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/docs/standard/serialization/system-text-json/nullable-annotations.md b/docs/standard/serialization/system-text-json/nullable-annotations.md index 8a5f7d65f44ad..06193824a24c8 100644 --- a/docs/standard/serialization/system-text-json/nullable-annotations.md +++ b/docs/standard/serialization/system-text-json/nullable-annotations.md @@ -1,8 +1,9 @@ --- title: Respect nullable annotations description: "Learn how to configure serialization and deserialization to respect nullable annotations." -ms.date: 10/22/2024 +ms.date: 10/20/2025 no-loc: [System.Text.Json, Newtonsoft.Json] +ai-usage: ai-assisted --- # Respect nullable annotations @@ -84,6 +85,21 @@ record MyPoco( ); ``` +## Missing values versus null values + +It's important to understand the distinction between *missing JSON properties* and *properties with explicit `null` values* when you set . JavaScript distinguishes between `undefined` (missing property) and `null` (explicit null value). However, .NET doesn't have an `undefined` concept, so both cases deserialize to `null` in .NET. + +During deserialization, when `RespectNullableAnnotations` is `true`: + +- An **explicit null value** throws an exception for non-nullable properties. For example, `{"Name":null}` throws an exception when deserializing to a non-nullable `string Name` property. +- A **missing property** doesn't throw an exception, even for non-nullable properties. For example, `{}` doesn't throw an exception when deserializing to a non-nullable `string Name` property. The serializer doesn't set the property, leaving it at its default value from the constructor. For an uninitialized non-nullable reference type, this results in `null`, which triggers a compiler warning. + + The following code shows how a missing property does NOT throw an exception during deserialization: + + :::code language="csharp" source="snippets/nullable-annotations/Nullable.cs" id="MissingVsNull"::: + +This behavior difference occurs because missing properties are treated as optional (not provided), while explicit `null` values are treated as provided values that violate the non-nullable constraint. If you need to enforce that a property must be present in the JSON, use the `required` modifier or configure the property as required using or the contracts model. + ## See also - [Non-optional constructor parameters](required-properties.md#non-optional-constructor-parameters) diff --git a/docs/standard/serialization/system-text-json/snippets/nullable-annotations/Nullable.cs b/docs/standard/serialization/system-text-json/snippets/nullable-annotations/Nullable.cs index 99cbf61b9a71f..86c2fc086f4de 100644 --- a/docs/standard/serialization/system-text-json/snippets/nullable-annotations/Nullable.cs +++ b/docs/standard/serialization/system-text-json/snippets/nullable-annotations/Nullable.cs @@ -58,3 +58,24 @@ record Person(string Name); // } +public static class Nullable4 +{ + // + public static void RunIt() + { +#nullable enable + JsonSerializerOptions options = new() + { + RespectNullableAnnotations = true + }; + + // Missing property - does NOT throw an exception. + string jsonMissing = """{}"""; + var resultMissing = JsonSerializer.Deserialize(jsonMissing, options); + Console.WriteLine(resultMissing.Name is null); // True. + } + + record Person(string Name); + // +} + diff --git a/docs/standard/serialization/system-text-json/snippets/nullable-annotations/Program.cs b/docs/standard/serialization/system-text-json/snippets/nullable-annotations/Program.cs index 816681470e389..82413ada4b464 100644 --- a/docs/standard/serialization/system-text-json/snippets/nullable-annotations/Program.cs +++ b/docs/standard/serialization/system-text-json/snippets/nullable-annotations/Program.cs @@ -1,3 +1,4 @@ //Nullable1.RunIt(); //Nullable2.RunIt(); -Nullable3.RunIt(); +//Nullable3.RunIt(); +Nullable4.RunIt(); From 8561836408a68ad71367b7fe4c5b5412780bf68e Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:26:35 -0800 Subject: [PATCH 07/38] Expand upgrade documentation with version pinning and controlled upgrade guidance (#49510) --- docs/core/install/upgrade.md | 169 +++++++++++++++++- .../code-analysis/configuration-options.md | 16 +- 2 files changed, 175 insertions(+), 10 deletions(-) diff --git a/docs/core/install/upgrade.md b/docs/core/install/upgrade.md index 8fa3fee613b96..c4159da908a94 100644 --- a/docs/core/install/upgrade.md +++ b/docs/core/install/upgrade.md @@ -1,7 +1,8 @@ --- title: Upgrade to a new .NET version -description: Learn how to upgrade an app to a new .NET version. Upgrade .NET when the current version goes out of support or when you want to use new features of .NET. -ms.date: 11/11/2024 +description: Learn how to upgrade an app to a new .NET version. Upgrade .NET when the current version goes out of support or when you want to use new features of .NET. Control versions of SDK, analyzers, and packages for predictable builds. +ms.date: 10/28/2025 +ai-usage: ai-assisted --- # Upgrade to a new .NET version @@ -51,6 +52,165 @@ More resources: - [Migrate an ASP.NET Core app](/aspnet/core/migration/) - [Upgrade .NET MAUI from .NET 7 to .NET 8](https://github.com/dotnet/maui/wiki/Upgrading-.NET-MAUI-from-.NET-7-to-.NET-8) +## Version pinning + +When you upgrade development tools like the .NET SDK, Visual Studio, or other components, you might encounter new behaviors, analyzer warnings, or breaking changes that affect your build process. By pinning to a version, you can upgrade your development environment while maintaining control over when specific components are updated in your projects. + +Version pinning provides several benefits: + +- **Predictable builds**: Ensures consistent build results across different machines and CI/CD environments. +- **Gradual adoption**: Allows you to adopt new features incrementally rather than all at once. +- **Avoid unexpected changes**: Prevents new analyzer rules, SDK behaviors, or package versions from causing build failures. +- **Team coordination**: Enables teams to upgrade together at a planned time rather than individually when tools update. +- **Debugging and troubleshooting**: Makes it easier to isolate issues when you control which versions changed. + +The following sections describe various mechanisms for controlling versions of different components in your .NET projects: + +- [Control SDK version with global.json](#control-sdk-version-with-globaljson) +- [Control analyzer behavior](#control-analyzer-behavior) +- [Control NuGet package versions](#control-nuget-package-versions) +- [Control MSBuild version](#control-msbuild-version) + +### Control SDK version with global.json + +You can pin the .NET SDK version for a project or solution by using a *global.json* file. This file specifies which SDK version to use when running .NET CLI commands and is independent of the runtime version your project targets. + +Create a *global.json* file in your solution root directory: + +```dotnetcli +dotnet new globaljson --sdk-version 9.0.100 --roll-forward latestFeature +``` + +This command creates the following *global.json* file that pins the SDK to version 9.0.100 or any later patch or feature band within the 9.0 major version: + +```json +{ + "sdk": { + "version": "9.0.100", + "rollForward": "latestFeature" + } +} +``` + +The `rollForward` policy controls how the SDK version is selected when the exact version isn't available. This configuration ensures that when you upgrade Visual Studio or install a new SDK, your project continues to use SDK 9.0.x until you explicitly update the *global.json* file. + +For more information, see [global.json overview](../tools/global-json.md). + +### Control analyzer behavior + +Code analyzers can introduce new warnings or change behavior between versions. You can control analyzer versions to maintain consistent builds by using the [`AnalysisLevel` property](../project-sdk/msbuild-props.md#analysislevel). This property allows you to lock to a specific version of analyzer rules, preventing new rules from being introduced when you upgrade the SDK. + +```xml + + 9.0 + +``` + +When set to `9.0`, only the analyzer rules that shipped with .NET 9 are enabled, even if you're using the .NET 10 SDK. This prevents new .NET 10 analyzer rules from affecting your build until you're ready to address them. + +For more information, see [AnalysisLevel](../project-sdk/msbuild-props.md#analysislevel). + +### Control NuGet package versions + +By managing package versions consistently across projects, you can prevent unexpected updates and maintain reliable builds. + +- [Package lock files](#package-lock-files) +- [Central package management](#central-package-management) +- [Package source mapping](#package-source-mapping) + +#### Package lock files + +Package lock files ensure that package restore operations use the exact same package versions across different environments. The lock file (`packages.lock.json`) records the exact versions of all packages and their dependencies. + +Enable lock files in your project file: + +```xml + + true + +``` + +To ensure builds fail if the lock file is out of date: + +```xml + + true + true + +``` + +After enabling lock files, run `dotnet restore` to generate the *packages.lock.json* file. Commit this file to source control. + +#### Central package management + +Central package management (CPM) allows you to manage package versions in a single location for all projects in a solution. This approach simplifies version management and ensures consistency across projects. + +Create a *Directory.Packages.props* file in your solution root: + +```xml + + + true + + + + + + + +``` + +In your project files, reference packages without specifying a version: + +```xml + + + + +``` + +#### Package source mapping + +Package source mapping allows you to control which NuGet feeds are used for specific packages, improving security and reliability. + +Configure source mapping in your *nuget.config* file: + +```xml + + + + + + + + + + + + + + + +``` + +This configuration ensures that all packages starting with `Contoso.` are only restored from the `contoso` feed, while other packages come from `nuget.org`. + +For more information, see [NuGet package restore](../tools/dotnet-restore.md). + +### Control MSBuild version + +Visual Studio supports side-by-side installation of multiple versions. For example, you can install Visual Studio 2026 and Visual Studio 2022 on the same machine. Each Visual Studio version includes a corresponding .NET SDK. When you update Visual Studio, the included SDK version is updated as well. However, you can continue using older SDK versions by installing them separately from the [.NET download page](https://dotnet.microsoft.com/download). + +MSBuild versions correspond to Visual Studio versions. For example, Visual Studio 2022 version 17.8 includes MSBuild 17.8. The .NET SDK also includes MSBuild. When you use `dotnet build`, you're using the MSBuild version included with the SDK specified by *global.json* or the latest installed SDK. + +To use a specific MSBuild version: + +- Use `dotnet build` with a pinned SDK version in *global.json*. +- Launch the appropriate Visual Studio Developer Command Prompt, which sets up the environment for that Visual Studio version's MSBuild. +- Directly invoke MSBuild from a specific Visual Studio installation (for example, `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe"`). + +For more information, see [.NET SDK, MSBuild, and Visual Studio versioning](../porting/versioning-sdk-msbuild-vs.md). + ## Update continuous integration (CI) CI pipelines follow a similar update process as project files and Dockerfiles. Typically, you can update [CI pipelines](https://github.com/actions/setup-dotnet) by changing only version values. @@ -68,3 +228,8 @@ FROM mcr.microsoft.com/dotnet/aspnet:9.0 ``` In a cloud service like [Azure App Service](/azure/app-service/quickstart-dotnetcore), a configuration change is needed. + +## See also + +- [Breaking changes in .NET 10](../compatibility/10.0.md) +- [Migrate an ASP.NET Core app](/aspnet/core/migration/) diff --git a/docs/fundamentals/code-analysis/configuration-options.md b/docs/fundamentals/code-analysis/configuration-options.md index 031c5a9a712f1..662aac41be0bd 100644 --- a/docs/fundamentals/code-analysis/configuration-options.md +++ b/docs/fundamentals/code-analysis/configuration-options.md @@ -78,14 +78,14 @@ Rule-specific options can be applied to a single rule, a set of rules, or all ru The following table shows the different rule severities that you can configure for all analyzer rules, including [code quality](quality-rules/index.md) and [code style](style-rules/index.md) rules. -| Severity configuration value | Build-time behavior | -|-|-| -| `error` | Violations appear as build *errors* and cause builds to fail.| -| `warning` | Violations appear as build *warnings* but do not cause builds to fail (unless you have an option set to treat warnings as errors). | -| `suggestion` | Violations appear as build *messages* and as suggestions in the Visual Studio IDE. (In Visual Studio, suggestions appear as three gray dots under the first two characters.) | -| `silent` | Violations aren't visible to the user.

However, for code-style rules, Visual Studio code-generation features still generate code in this style. These rules also participate in cleanup and appear in the **Quick Actions and Refactorings** menu in Visual Studio. | -| `none` | Rule is suppressed completely.

However, for code-style rules, Visual Studio code-generation features still generate code in this style. | -| `default` | The default severity of the rule is used. The default severities for each .NET release are listed in the [roslyn-analyzers repo](https://github.com/dotnet/roslyn-analyzers/blob/main/src/NetAnalyzers/Core/AnalyzerReleases.Shipped.md). In that table, "Disabled" corresponds to `none`, "Hidden" corresponds to `silent`, and "Info" corresponds to `suggestion`. | +| Severity configuration value | Build-time behavior | +|------------------------------|---------------------------------------------------------------| +| `error` | Violations appear as build *errors* and cause builds to fail. | +| `warning` | Violations appear as build *warnings* but do not cause builds to fail (unless you have an option set to treat warnings as errors). | +| `suggestion` | Violations appear as build *messages* and as suggestions in the Visual Studio IDE. (In Visual Studio, suggestions appear as three gray dots under the first two characters.) | +| `silent` | Violations aren't visible to the user.

However, for code-style rules, Visual Studio code-generation features still generate code in this style. These rules also participate in cleanup and appear in the **Quick Actions and Refactorings** menu in Visual Studio. | +| `none` | Rule is suppressed completely.

However, for code-style rules, Visual Studio code-generation features still generate code in this style. | +| `default` | The default severity of the rule is used. The default severities for each .NET release are listed in the [roslyn-analyzers repo](https://github.com/dotnet/roslyn-analyzers/blob/main/src/NetAnalyzers/Core/AnalyzerReleases.Shipped.md). In that table, "Disabled" corresponds to `none`, "Hidden" corresponds to `silent`, and "Info" corresponds to `suggestion`. | #### Scope From af3107cdbc18f49b486ecf4982a912058d05a400 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 10:07:41 -0800 Subject: [PATCH 08/38] Document breaking change: Code coverage EnableDynamicNativeInstrumentation defaults to false in .NET 10 (#49620) --- docs/core/compatibility/10.0.md | 1 + ...coverage-dynamic-native-instrumentation.md | 66 +++++++++++++++++++ docs/core/compatibility/toc.yml | 2 + 3 files changed, 69 insertions(+) create mode 100644 docs/core/compatibility/sdk/10.0/code-coverage-dynamic-native-instrumentation.md diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index b5e54a5d9c0b8..c91a500c8e37a 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -117,6 +117,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af | [.NET CLI `--interactive` defaults to `true` in user scenarios](sdk/10.0/dotnet-cli-interactive.md) | Behavioral change | Preview 3 | | [`dotnet` CLI commands log non-command-relevant data to stderr](sdk/10.0/dotnet-cli-stderr-output.md) | Behavioral change | RC 2 | | [.NET tool packaging creates RuntimeIdentifier-specific tool packages](sdk/10.0/dotnet-tool-pack-publish.md) | Behavioral change | Preview 6 | +| [Code coverage EnableDynamicNativeInstrumentation defaults to false](sdk/10.0/code-coverage-dynamic-native-instrumentation.md) | Behavioral change | GA | | [Default workload configuration from 'loose manifests' to 'workload sets' mode](sdk/10.0/default-workload-config.md) | Behavioral change | Preview 2 | | [dnx.ps1 file is no longer included in .NET SDK](sdk/10.0/dnx-ps1-removed.md) | Source incompatible | GA | | [Double quotes in file-level directives are disallowed](sdk/10.0/file-level-directive-double-quotes.md) | Source incompatible | GA | diff --git a/docs/core/compatibility/sdk/10.0/code-coverage-dynamic-native-instrumentation.md b/docs/core/compatibility/sdk/10.0/code-coverage-dynamic-native-instrumentation.md new file mode 100644 index 0000000000000..42357703a88c5 --- /dev/null +++ b/docs/core/compatibility/sdk/10.0/code-coverage-dynamic-native-instrumentation.md @@ -0,0 +1,66 @@ +--- +title: "Breaking change - Code coverage EnableDynamicNativeInstrumentation defaults to false" +description: "Learn about the breaking change in .NET 10 where dynamic native instrumentation is disabled by default when collecting code coverage." +ms.date: 11/05/2025 +ai-usage: ai-assisted +ms.custom: https://github.com/dotnet/docs/issues/49376 +--- + +# Code coverage EnableDynamicNativeInstrumentation defaults to false + +Running `dotnet test --collect:"Code Coverage"` now disables dynamic native instrumentation by default. This change affects how code coverage is collected from native code. It doesn't affect how code coverage is collected from managed code. + +## Version introduced + +.NET 10 GA + +## Previous behavior + +Previously, dynamic native instrumentation was enabled by default and used a fallback for native modules when static native instrumentation couldn't be used. This behavior is described in [Static and dynamic native instrumentation](/visualstudio/test/customizing-code-coverage-analysis?view=vs-2022#static-and-dynamic-native-instrumentation). + +```bash +dotnet test --collect:"Code Coverage" +# Dynamic native instrumentation was enabled by default +``` + +## New behavior + +Starting in .NET 10, dynamic native instrumentation is disabled by default. The `false` option is set by default from `dotnet test` and `vstest`. If you explicitly set the option in a *runsettings* file, it isn't overridden. + +```bash +dotnet test --collect:"Code Coverage" +# Dynamic native instrumentation is now disabled by default +``` + +You can re-enable dynamic native instrumentation by setting `true` in your *runsettings* file. However, when you do so, it might fail with "The code execution cannot proceed because covrun64.dll was not found." This error can also happen for `covrun32.dll` in a 32-bit process. + +## Type of breaking change + +This change is a [behavioral change](../../categories.md#behavioral-change). + +## Reason for change + +Dynamic native instrumentation was enabled by default to maintain backwards compatibility in `dotnet test`. However, its way of injecting DLLs into the process isn't standard. With [security hardening changes](https://github.com/dotnet/runtime/pull/112359) in the .NET 10 runtime, it fails to find the linked DLL, causing the process to [crash with error](https://github.com/dotnet/sdk/issues/50950). The error might not be visible in non-interactive sessions or in the command line, but the process does crash. + +Dynamic native instrumentation is already disabled by default by `dotnet-coverage`, which is an alternative way to collect code coverage using the same underlying tools. It's also disabled by default for solutions in Visual Studio that don't have native projects. + +## Recommended action + +If you collect coverage on solutions that don't have any native components, you shouldn't be affected. However, you might observe increased performance when collecting coverage. + +If you collect coverage on solutions that include native components, such as C++ projects, you have the following options: + +- Configure your projects to use [static native instrumentation](/visualstudio/test/customizing-code-coverage-analysis#static-and-dynamic-native-instrumentation) + + OR + +- Update to Microsoft.CodeCoverage 18.0.1 and enable dynamic native instrumentation: + + - Add the setting `true` to your *runsettings* file. + - Globally opt out from this new default by setting the `VSTEST_DISABLE_DYNAMICNATIVE_CODECOVERAGE_DEFAULT_SETTING=1` environment variable. + + Similarly, when collecting code coverage with `vstest.console`, VSTest version 18.0.1 and newer is required to successfully collect dynamic native coverage on systems that have the .NET 10 SDK installed. + +## Affected APIs + +None. diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 047ad3a288742..7e7ee333fe6ec 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -126,6 +126,8 @@ items: href: reflection/10/makegeneric-signaturetype-validation.md - name: SDK and MSBuild items: + - name: Code coverage EnableDynamicNativeInstrumentation defaults to false + href: sdk/10.0/code-coverage-dynamic-native-instrumentation.md - name: .NET CLI `--interactive` defaults to `true` in user scenarios href: sdk/10.0/dotnet-cli-interactive.md - name: "`dotnet` CLI commands log non-command-relevant data to stderr" From 0a90a8334ccbc1220c457061712d0e34ca22d115 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 10:08:48 -0800 Subject: [PATCH 09/38] Update .NET AI ecosystem docs to feature Microsoft Agent Framework (#49616) --- docs/ai/dotnet-ai-ecosystem.md | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/docs/ai/dotnet-ai-ecosystem.md b/docs/ai/dotnet-ai-ecosystem.md index fa8b677076a2d..b5448d3fd81c2 100644 --- a/docs/ai/dotnet-ai-ecosystem.md +++ b/docs/ai/dotnet-ai-ecosystem.md @@ -1,7 +1,7 @@ --- title: .NET + AI ecosystem tools and SDKs description: This article provides an overview of the ecosystem of SDKs and tools available to .NET developers integrating AI into their applications. -ms.date: 05/29/2025 +ms.date: 11/04/2025 ms.topic: overview --- @@ -18,19 +18,26 @@ The .NET ecosystem provides many powerful tools, libraries, and services to deve `Microsoft.Extensions.AI` provides abstractions that can be implemented by various services, all adhering to the same core concepts. This library is not intended to provide APIs tailored to any specific provider's services. The goal of `Microsoft.Extensions.AI` is to act as a unifying layer within the .NET ecosystem, enabling developers to choose their preferred frameworks and libraries while ensuring seamless integration and collaboration across the ecosystem. -## Semantic Kernel for .NET +## Microsoft Agent Framework + +If you want to use low-level services, such as and , you can reference the `Microsoft.Extensions.AI.Abstractions` package directly from your app. However, if you want to build agentic AI applications with higher-level orchestration capabilities, you should use [Microsoft Agent Framework](/agent-framework/overview/agent-framework-overview). Agent Framework builds on the `Microsoft.Extensions.AI.Abstractions` package and provides concrete implementations of for different services, including OpenAI, Azure OpenAI, Azure AI Foundry, and more. + +This framework is the recommended approach for .NET apps that need to build agentic AI systems with advanced orchestration, multi-agent collaboration, and enterprise-grade security and observability. -If you just want to use the low-level services, such as and , you can reference the `Microsoft.Extensions.AI.Abstractions` package directly from your app. However, if you want to use higher-level, more opinionated approaches to AI, then you should use [Semantic Kernel](/semantic-kernel/overview/). +Agent Framework is a production-ready, open-source framework that brings together the best capabilities of Semantic Kernel and Microsoft Research's AutoGen. Agent Framework provides: -Semantic Kernel, which has a dependency on the `Microsoft.Extensions.AI.Abstractions` package, is an open-source library that enables AI integration and orchestration capabilities in your .NET apps. Its connectors provides concrete implementations of and for different services, including OpenAI, Amazon Bedrock, and Google Gemini. +- **Multi-agent orchestration**: Support for sequential, concurrent, group chat, handoff, and *magentic* (where a lead agent directs other agents) orchestration patterns. +- **Cloud and provider flexibility**: Cloud-agnostic (containers, on-premises, or multi-cloud) and provider-agnostic (for example, OpenAI or Azure AI Foundry) using plugin and connector models. +- **Enterprise-grade features**: Built-in observability (OpenTelemetry), Microsoft Entra security integration, and responsible AI features including prompt injection protection and task adherence monitoring. +- **Standards-based interoperability**: Integration with open standards like Agent-to-Agent (A2A) protocol and Model Context Protocol (MCP) for agent discovery and tool interaction. -The Semantic Kernel SDK is generally the recommended AI orchestration tool for .NET apps that use one or more AI services in combination with other APIs or web services, data stores, and custom code. Semantic Kernel benefits enterprise developers in the following ways: +For more information, see the [Microsoft Agent Framework documentation](/agent-framework/overview/agent-framework-overview). + +## Semantic Kernel for .NET -- Streamlines integration of AI capabilities into existing applications to enable a cohesive solution for enterprise products. -- Minimizes the learning curve of working with different AI models or services by providing abstractions that reduce complexity. -- Improves reliability by reducing the unpredictable behavior of prompts and responses from AI models. You can fine-tune prompts and plan tasks to create a controlled and predictable user experience. +[Semantic Kernel](/semantic-kernel/overview/) is an open-source library that enables AI integration and orchestration capabilities in your .NET apps. Semantic Kernel has a dependency on the `Microsoft.Extensions.AI.Abstractions` package and provides connectors with concrete implementations of and for different services, including OpenAI, Amazon Bedrock, and Google Gemini. -For more information, see the [Semantic Kernel documentation](/semantic-kernel/overview/). +However, for new applications that require agentic capabilities, multi-agent orchestration, or enterprise-grade observability and security, the recommended framework is [Microsoft Agent Framework](/agent-framework/overview/agent-framework-overview). ## .NET SDKs for building AI apps @@ -40,6 +47,7 @@ Many different SDKs are available to build .NET apps with AI capabilities depend | NuGet package | Supported models | Maintainer or vendor | Documentation | |---------------|------------------|----------------------|--------------| +| [Microsoft.Agents.AI.OpenAI](https://www.nuget.org/packages/Microsoft.Agents.AI.OpenAI/) | [OpenAI models](https://platform.openai.com/docs/models/overview)
[Azure OpenAI supported models](/azure/ai-services/openai/concepts/models) | [Microsoft Agent Framework](https://github.com/microsoft/agent-framework) (Microsoft) | [Agent Framework documentation](/agent-framework/overview/agent-framework-overview) | | [Microsoft.SemanticKernel](https://www.nuget.org/packages/Microsoft.SemanticKernel/) | [OpenAI models](https://platform.openai.com/docs/models/overview)
[Azure OpenAI supported models](/azure/ai-services/openai/concepts/models) | [Semantic Kernel](https://github.com/microsoft/semantic-kernel) (Microsoft) | [Semantic Kernel documentation](/semantic-kernel/) | | [Azure OpenAI SDK](https://www.nuget.org/packages/Azure.AI.OpenAI/) | [Azure OpenAI supported models](/azure/ai-services/openai/concepts/models) | [Azure SDK for .NET](https://github.com/Azure/azure-sdk-for-net) (Microsoft) | [Azure OpenAI services documentation](/azure/ai-services/openai/) | | [OpenAI SDK](https://www.nuget.org/packages/OpenAI/) | [OpenAI supported models](https://platform.openai.com/docs/models) | [OpenAI SDK for .NET](https://github.com/openai/openai-dotnet) (OpenAI) | [OpenAI services documentation](https://platform.openai.com/docs/overview) | @@ -60,7 +68,7 @@ Azure offers many other AI services to build specific application capabilities a ## Develop with local AI models -.NET apps can also connect to local AI models for many different development scenarios. [Semantic Kernel](https://github.com/microsoft/semantic-kernel) is the recommended tool to connect to local models using .NET. Semantic Kernel can connect to many different models hosted across a variety of platforms and abstracts away lower-level implementation details. +.NET apps can also connect to local AI models for many different development scenarios. [Microsoft Agent Framework](https://github.com/microsoft/agent-framework) is the recommended tool to connect to local models using .NET. This framework can connect to many different models hosted across a variety of platforms and abstracts away lower-level implementation details. For example, you can use [Ollama](https://ollama.com/) to [connect to local AI models with .NET](quickstarts/chat-local-model.md), including several small language models (SLMs) developed by Microsoft: @@ -78,6 +86,7 @@ For example, you can use [Ollama](https://ollama.com/) to [connect to local AI m ## Next steps +- [What is Microsoft Agent Framework?](/agent-framework/overview/agent-framework-overview) - [What is Semantic Kernel?](/semantic-kernel/overview/) - [Quickstart - Summarize text using Azure AI chat app with .NET](quickstarts/prompt-model.md) From ca9318019e29109d8678f9e7d228b5a99db0511b Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 18:13:44 +0000 Subject: [PATCH 10/38] Add documentation for CA2026: Prefer JsonElement.Parse over JsonDocument.Parse().RootElement (#49640) --- .../code-analysis/quality-rules/ca2026.md | 77 +++++++++++++++++++ .../code-analysis/quality-rules/index.md | 1 + .../quality-rules/reliability-warnings.md | 1 + .../csharp/all-rules/all-rules.csproj | 2 +- .../snippets/csharp/all-rules/ca2026.cs | 23 ++++++ .../snippets/vb/all-rules/all-rules.vbproj | 2 +- .../snippets/vb/all-rules/ca2026.vb | 23 ++++++ docs/navigate/tools-diagnostics/toc.yml | 2 + 8 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 docs/fundamentals/code-analysis/quality-rules/ca2026.md create mode 100644 docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca2026.cs create mode 100644 docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/ca2026.vb diff --git a/docs/fundamentals/code-analysis/quality-rules/ca2026.md b/docs/fundamentals/code-analysis/quality-rules/ca2026.md new file mode 100644 index 0000000000000..99e2c74659bab --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/ca2026.md @@ -0,0 +1,77 @@ +--- +title: "CA2026: Prefer JsonElement.Parse over JsonDocument.Parse().RootElement" +description: "Learn about code analysis rule CA2026 - Prefer JsonElement.Parse over JsonDocument.Parse().RootElement" +ms.date: 11/05/2025 +f1_keywords: + - CA2026 + - PreferJsonElementParseOverJsonDocumentParse +helpviewer_keywords: + - CA2026 +ai-usage: ai-assisted +dev_langs: +- CSharp +- VB +--- + +# CA2026: Prefer JsonElement.Parse over JsonDocument.Parse().RootElement + +| Property | Value | +|-------------------------------------|--------------------------------------------------------------------------| +| **Rule ID** | CA2026 | +| **Title** | Prefer `JsonElement.Parse` over `JsonDocument.Parse().RootElement` | +| **Category** | [Reliability](reliability-warnings.md) | +| **Fix is breaking or non-breaking** | Non-breaking | +| **Enabled by default in .NET 10** | As suggestion | + +## Cause + +Code uses `JsonDocument.Parse().RootElement` to parse JSON into a . + +## Rule description + + is more efficient than calling `JsonDocument.Parse().RootElement`. The type implements and rents arrays from the , which can lead to memory leaks or increased GC pressure if you don't properly dispose the document. The `JsonElement.Parse` method, introduced in .NET 10, parses JSON directly into a without these concerns, making it more efficient and less error-prone. + +## How to fix violations + +Replace calls to `JsonDocument.Parse().RootElement` with `JsonElement.Parse()`. + +## Examples + +The following code snippet shows a violation of CA2026: + +:::code language="csharp" source="snippets/csharp/all-rules/ca2026.cs" id="Violation"::: +:::code language="vb" source="snippets/vb/all-rules/ca2026.vb" id="Violation"::: + +The following code snippet fixes the violation: + +:::code language="csharp" source="snippets/csharp/all-rules/ca2026.cs" id="Fixed"::: +:::code language="vb" source="snippets/vb/all-rules/ca2026.vb" id="Fixed"::: + +## When to suppress warnings + +Don't suppress warnings from this rule. If you're targeting .NET 10 or later, you should use `JsonElement.Parse()` for better performance and resource management. + +## Suppress a warning + +If you just want to suppress a single violation, add preprocessor directives to your source file to disable and then re-enable the rule. + +```csharp +#pragma warning disable CA2026 +// The code that's violating the rule is on this line. +#pragma warning restore CA2026 +``` + +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_diagnostic.CA2026.severity = none +``` + +For more information, see [How to suppress code analysis warnings](../suppress-warnings.md). + +## See also + +- [Reliability rules](reliability-warnings.md) +- +- diff --git a/docs/fundamentals/code-analysis/quality-rules/index.md b/docs/fundamentals/code-analysis/quality-rules/index.md index 720c1eb06c983..fed4ba75a01f8 100644 --- a/docs/fundamentals/code-analysis/quality-rules/index.md +++ b/docs/fundamentals/code-analysis/quality-rules/index.md @@ -196,6 +196,7 @@ The following table lists code quality analysis rules. > | [CA2023: Invalid braces in message template](ca2023.md) | The braces present in the message template are invalid. Ensure any braces in the message template are valid opening/closing braces, or are escaped. | > | [CA2024: Do not use StreamReader.EndOfStream in async methods](ca2024.md) | The property can cause unintended synchronous blocking when no data is buffered. Instead, use directly, which returns `null` when reaching the end of the stream. | > | [CA2025: Do not pass `IDisposable` instances into unawaited tasks](ca2025.md) | Unawaited tasks that use `IDisposable` instances might use those instances long after they have been disposed. Ensure tasks using those instances are completed before the instances are disposed. | +> | [CA2026: Prefer JsonElement.Parse over JsonDocument.Parse().RootElement](ca2026.md) | It's more efficient to call `JsonElement.Parse` directly than to call `JsonDocument.Parse().RootElement`. | > | [CA2100: Review SQL queries for security vulnerabilities](ca2100.md) | A method sets the System.Data.IDbCommand.CommandText property by using a string that is built from a string argument to the method. This rule assumes that the string argument contains user input. A SQL command string that is built from user input is vulnerable to SQL injection attacks. | > | [CA2101: Specify marshalling for P/Invoke string arguments](ca2101.md) | A platform invoke member allows partially trusted callers, has a string parameter, and does not explicitly marshal the string. This can cause a potential security vulnerability. | > | [CA2109: Review visible event handlers](ca2109.md) | A public or protected event-handling method was detected. Event-handling methods should not be exposed unless absolutely necessary. | diff --git a/docs/fundamentals/code-analysis/quality-rules/reliability-warnings.md b/docs/fundamentals/code-analysis/quality-rules/reliability-warnings.md index 6437efebefa8a..41120f7ae0107 100644 --- a/docs/fundamentals/code-analysis/quality-rules/reliability-warnings.md +++ b/docs/fundamentals/code-analysis/quality-rules/reliability-warnings.md @@ -35,3 +35,4 @@ Reliability rules support library and application reliability, such as correct m | [CA2023: Invalid braces in message template](ca2023.md) | Logging message templates use curly braces `{` and `}` to denote named placeholders for values. Invalid brace usage in message templates can result in runtime exceptions or unexpected logging behavior. | | [CA2024: Do not use StreamReader.EndOfStream in async methods](ca2024.md) | The property can cause unintended synchronous blocking when no data is buffered. Instead, use directly, which returns `null` when reaching the end of the stream. | | [CA2025: Do not pass `IDisposable` instances into unawaited tasks](ca2025.md) | Unawaited tasks that use `IDisposable` instances might use those instances long after they have been disposed. Ensure tasks using those instances are completed before the instances are disposed. | +| [CA2026: Prefer JsonElement.Parse over JsonDocument.Parse().RootElement](ca2026.md) | It's more efficient to call directly than to call `JsonDocument.Parse().RootElement`. | diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/all-rules.csproj b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/all-rules.csproj index b286c3c5c450a..d73c66d23f908 100644 --- a/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/all-rules.csproj +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/all-rules.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable all_rules diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca2026.cs b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca2026.cs new file mode 100644 index 0000000000000..3284ccf49ffa3 --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca2026.cs @@ -0,0 +1,23 @@ +using System.Text.Json; + +namespace ca2026 +{ + public static class Examples + { + // + public static void ProcessJsonViolation(string json) + { + JsonElement element = JsonDocument.Parse(json).RootElement; + //... + } + // + + // + public static void ProcessJsonFixed(string json) + { + JsonElement element = JsonElement.Parse(json); + //... + } + // + } +} diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/all-rules.vbproj b/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/all-rules.vbproj index a651c1e18355e..d8d4f77b12ce8 100644 --- a/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/all-rules.vbproj +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/all-rules.vbproj @@ -3,7 +3,7 @@ Exe all_rules - net9.0 + net10.0 $(NoWarn);SYSLIB0050 diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/ca2026.vb b/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/ca2026.vb new file mode 100644 index 0000000000000..e6a51972dd137 --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/ca2026.vb @@ -0,0 +1,23 @@ +Imports System.Text.Json + +Namespace ca2026 + + Public Module Examples + + ' + Public Sub ProcessJsonViolation(json As String) + Dim element As JsonElement = JsonDocument.Parse(json).RootElement + '... + End Sub + ' + + ' + Public Sub ProcessJsonFixed(json As String) + Dim element As JsonElement = JsonElement.Parse(json) + '... + End Sub + ' + + End Module + +End Namespace diff --git a/docs/navigate/tools-diagnostics/toc.yml b/docs/navigate/tools-diagnostics/toc.yml index 629a2c1d8e076..c6a85a983e25b 100644 --- a/docs/navigate/tools-diagnostics/toc.yml +++ b/docs/navigate/tools-diagnostics/toc.yml @@ -3347,6 +3347,8 @@ items: href: ../../fundamentals/code-analysis/quality-rules/ca2024.md - name: CA2025 href: ../../fundamentals/code-analysis/quality-rules/ca2025.md + - name: CA2026 + href: ../../fundamentals/code-analysis/quality-rules/ca2026.md - name: Security rules items: - name: Overview From 37681517999806bbe53e89cb0e6216e95e2f7d0e Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 10:22:49 -0800 Subject: [PATCH 11/38] Document CompositeMLDsa update to draft-08 breaking change (#49609) --- docs/core/compatibility/10.0.md | 1 + .../10.0/composite-mldsa-draft-08.md | 45 +++++++++++++++++++ docs/core/compatibility/toc.yml | 2 + docs/core/whats-new/dotnet-10/libraries.md | 2 +- 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 docs/core/compatibility/cryptography/10.0/composite-mldsa-draft-08.md diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index c91a500c8e37a..4960a56abbb54 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -61,6 +61,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af | Title | Type of change | Introduced version | |-------|-------------------|--------------------| +| [CompositeMLDsa updated to draft-08](cryptography/10.0/composite-mldsa-draft-08.md) | Behavioral change | 10.0.0 | | [CoseSigner.Key can be null](cryptography/10.0/cosesigner-key-null.md) | Behavioral/source incompatible change | Preview 7 | | [MLDsa and SlhDsa 'SecretKey' members renamed](cryptography/10.0/mldsa-slhdsa-secretkey-to-privatekey.md) | Source incompatible | RC 1 | | [OpenSSL cryptographic primitives aren't supported on macOS](cryptography/10.0/openssl-macos-unsupported.md) | Behavioral change | Preview 6 | diff --git a/docs/core/compatibility/cryptography/10.0/composite-mldsa-draft-08.md b/docs/core/compatibility/cryptography/10.0/composite-mldsa-draft-08.md new file mode 100644 index 0000000000000..62775430188b2 --- /dev/null +++ b/docs/core/compatibility/cryptography/10.0/composite-mldsa-draft-08.md @@ -0,0 +1,45 @@ +--- +title: "Breaking change - CompositeMLDsa updated to draft-08" +description: "Learn about the breaking change in .NET 10 where CompositeMLDsa was updated from draft-07 to draft-08 of the Composite ML-DSA for use in X.509 Public Key Infrastructure specification." +ms.date: 11/04/2025 +ai-usage: ai-assisted +ms.custom: https://github.com/dotnet/docs/issue/48901 +--- + +# CompositeMLDsa updated to draft-08 + + has moved from draft-07 to draft-08 of the [Composite ML-DSA for use in X.509 Public Key Infrastructure](https://datatracker.ietf.org/doc/draft-ietf-lamps-pq-composite-sigs/) specification. The draft-08 format is not compatible with the draft-07 signatures, and key export/import formats are also incompatible across the draft-07/draft-08 boundary. draft-08 and draft-09 are compatible. + +## Version introduced + +.NET 10 GA + +## Previous behavior + +In preview and RC releases of .NET 10, signatures were generated and validated according to draft-07 of Composite ML-DSA for use in X.509 Public Key Infrastructure. + +Public key and private key export and import used the format from draft-07 of Composite ML-DSA for use in X.509 Public Key Infrastructure. + +## New behavior + +Starting in the .NET 10 GA release, signatures are generated and validated according to draft-08 of Composite ML-DSA for use in X.509 Public Key Infrastructure. + +Public key and private key export and import use the format from draft-08 of Composite ML-DSA for use in X.509 Public Key Infrastructure. + +## Type of breaking change + +This change is a [behavioral change](../../categories.md#behavioral-change). + +## Reason for change + +This change was made to stay current with the underlying specification. + +## Recommended action + +The class is marked as `[Experimental]`, partly because the specification isn't yet complete. Do not depend on this class in production. + +Discard any previously generated keys and signatures. + +## Affected APIs + +- diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 7e7ee333fe6ec..4394916aa0483 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -70,6 +70,8 @@ items: href: core-libraries/10.0/ymm-embedded-rounding.md - name: Cryptography items: + - name: CompositeMLDsa updated to draft-08 + href: cryptography/10.0/composite-mldsa-draft-08.md - name: CoseSigner.Key can be null href: cryptography/10.0/cosesigner-key-null.md - name: Environment variable renamed to DOTNET_OPENSSL_VERSION_OVERRIDE diff --git a/docs/core/whats-new/dotnet-10/libraries.md b/docs/core/whats-new/dotnet-10/libraries.md index 5c365d47c0719..a7959b652e3e3 100644 --- a/docs/core/whats-new/dotnet-10/libraries.md +++ b/docs/core/whats-new/dotnet-10/libraries.md @@ -156,7 +156,7 @@ private static bool VerifyWithExternalMu(MLDsa verifyingKey, ReadOnlySpan #### Composite ML-DSA -.NET 10 introduces new types to support [ietf-lamps-pq-composite-sigs](https://datatracker.ietf.org/doc/draft-ietf-lamps-pq-composite-sigs/) (currently at draft 7), including the and types, with implementation of the primitive methods for RSA variants. +.NET 10 introduces new types to support [ietf-lamps-pq-composite-sigs](https://datatracker.ietf.org/doc/draft-ietf-lamps-pq-composite-sigs/) (at draft 8 as of .NET 10 GA), including the and types, with implementation of the primitive methods for RSA variants. ```csharp var algorithm = CompositeMLDsaAlgorithm.MLDsa65WithRSA4096Pss; From 03de92d71e820bea7b47af5aa7135ab89db9b30f Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 10:23:55 -0800 Subject: [PATCH 12/38] Add documentation for CA1877: Collapse consecutive Path.Combine/Path.Join operations (#49638) --- .../code-analysis/quality-rules/ca1877.md | 80 +++++++++++++++++++ .../code-analysis/quality-rules/index.md | 1 + .../quality-rules/performance-warnings.md | 1 + .../snippets/csharp/all-rules/ca1877.cs | 36 +++++++++ .../snippets/vb/all-rules/ca1877.vb | 31 +++++++ docs/navigate/tools-diagnostics/toc.yml | 2 + 6 files changed, 151 insertions(+) create mode 100644 docs/fundamentals/code-analysis/quality-rules/ca1877.md create mode 100644 docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1877.cs create mode 100644 docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/ca1877.vb diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1877.md b/docs/fundamentals/code-analysis/quality-rules/ca1877.md new file mode 100644 index 0000000000000..c0e3fb7961a73 --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/ca1877.md @@ -0,0 +1,80 @@ +--- +title: "CA1877: Use 'Path.Combine' or 'Path.Join' overloads (code analysis)" +description: "Learn about code analysis rule CA1877: Use 'Path.Combine' or 'Path.Join' overloads" +ms.date: 11/05/2025 +ms.topic: reference +f1_keywords: + - CA1877 + - UsePathCombineOrPathJoinAnalyzer +helpviewer_keywords: + - CA1877 +dev_langs: + - CSharp + - VB +ai-usage: ai-generated +--- + +# CA1877: Use 'Path.Combine' or 'Path.Join' overloads + +| Property | Value | +|-------------------------------------|----------------------------------------| +| **Rule ID** | CA1877 | +| **Title** | Use `Path.Combine` or `Path.Join` overloads | +| **Category** | [Performance](performance-warnings.md) | +| **Fix is breaking or non-breaking** | Non-breaking | +| **Enabled by default in .NET 10** | As suggestion | + +## Cause + +Multiple consecutive or operations are used to build a path. + +## Rule description + +When you use multiple consecutive `Path.Combine` or `Path.Join` operations, it's more efficient to use an overload that accepts multiple path segments. This approach reduces the number of allocations and function calls, improving performance. Both methods provide overloads that accept multiple parameters, allowing you to collapse consecutive operations into a single call. + +## How to fix violations + +Replace consecutive `Path.Combine` or `Path.Join` operations with a single call using an overload that accepts all path segments. + +A *code fix* that automatically performs this transformation is available. + +## Example + +The following code snippet shows a violation of CA1877: + +:::code language="csharp" source="./snippets/csharp/all-rules/CA1877.cs" id="Violation"::: +:::code language="vb" source="./snippets/vb/all-rules/CA1877.vb" id="Violation"::: + +The following code snippet fixes the violation: + +:::code language="csharp" source="./snippets/csharp/all-rules/CA1877.cs" id="Fix"::: +:::code language="vb" source="./snippets/vb/all-rules/CA1877.vb" id="Fix"::: + +## When to suppress warnings + +It's safe to suppress a warning from this rule if performance isn't a concern. + +## Suppress a warning + +If you just want to suppress a single violation, add preprocessor directives to your source file to disable and then re-enable the rule. + +```csharp +#pragma warning disable CA1877 +// The code that's violating the rule is on this line. +#pragma warning restore CA1877 +``` + +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_diagnostic.CA1877.severity = none +``` + +For more information, see [How to suppress code analysis warnings](../suppress-warnings.md). + +## See also + +- [Performance rules](performance-warnings.md) +- +- diff --git a/docs/fundamentals/code-analysis/quality-rules/index.md b/docs/fundamentals/code-analysis/quality-rules/index.md index fed4ba75a01f8..f501ebaaa1e34 100644 --- a/docs/fundamentals/code-analysis/quality-rules/index.md +++ b/docs/fundamentals/code-analysis/quality-rules/index.md @@ -176,6 +176,7 @@ The following table lists code quality analysis rules. > | [CA1873: Avoid potentially expensive logging](ca1873.md) | In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for logging arguments. | > | [CA1874: Use `Regex.IsMatch`](ca1874.md) | `Regex.IsMatch` is simpler and faster than `Regex.Match(...).Success`. | > | [CA1875: Use `Regex.Count`](ca1875.md) | `Regex.Count` is simpler and faster than `Regex.Matches(...).Count`. | +> | [CA1877: Use 'Path.Combine' or 'Path.Join' overloads](ca1877.md) | When multiple `Path.Combine` or `Path.Join` operations are nested, they can be collapsed into a single operation for better performance and readability. | > | [CA2000: Dispose objects before losing scope](ca2000.md) | Because an exceptional event might occur that will prevent the finalizer of an object from running, the object should be explicitly disposed before all references to it are out of scope. | > | [CA2002: Do not lock on objects with weak identity](ca2002.md) |An object is said to have a weak identity when it can be directly accessed across application domain boundaries. A thread that tries to acquire a lock on an object that has a weak identity can be blocked by a second thread in a different application domain that has a lock on the same object. | > | [CA2007: Do not directly await a Task](ca2007.md) | An asynchronous method [awaits](../../../csharp/language-reference/operators/await.md) a directly. When an asynchronous method awaits a directly, continuation occurs in the same thread that created the task. This behavior can be costly in terms of performance and can result in a deadlock on the UI thread. Consider calling to signal your intention for continuation. | diff --git a/docs/fundamentals/code-analysis/quality-rules/performance-warnings.md b/docs/fundamentals/code-analysis/quality-rules/performance-warnings.md index d46d9b9608e87..0e88fd280368f 100644 --- a/docs/fundamentals/code-analysis/quality-rules/performance-warnings.md +++ b/docs/fundamentals/code-analysis/quality-rules/performance-warnings.md @@ -83,3 +83,4 @@ Performance rules support high-performance libraries and applications. | [CA1873: Avoid potentially expensive logging](ca1873.md) | When logging methods are called, their arguments are evaluated regardless of whether the logging level is enabled. This can result in expensive operations being executed even when the log message won't be written. For better performance, guard expensive logging calls with a check to or use the `LoggerMessage` pattern. | | [CA1874: Use 'Regex.IsMatch'](ca1874.md) | is simpler and faster than `Regex.Match(...).Success`. | | [CA1875: Use 'Regex.Count'](ca1875.md) | is simpler and faster than `Regex.Matches(...).Count`. | +| [CA1877: Use 'Path.Combine' or 'Path.Join' overloads](ca1877.md) | Multiple consecutive or operations can be collapsed into a single call using overloads that accept multiple path segments. | diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1877.cs b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1877.cs new file mode 100644 index 0000000000000..f9de62f20db4d --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1877.cs @@ -0,0 +1,36 @@ +using System.IO; + +class ViolationExample +{ + // + public string GetFilePath(string folder, string subfolder, string filename) + { + // Violation. + string temp = Path.Combine(folder, subfolder); + return Path.Combine(temp, filename); + } + + public string GetLogPath(string baseDir, string date, string category) + { + // Violation. + return Path.Join(Path.Join(baseDir, date), category); + } + // +} + +class FixExample +{ + // + public string GetFilePath(string folder, string subfolder, string filename) + { + // No violation. + return Path.Combine(folder, subfolder, filename); + } + + public string GetLogPath(string baseDir, string date, string category) + { + // No violation. + return Path.Join(baseDir, date, category); + } + // +} diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/ca1877.vb b/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/ca1877.vb new file mode 100644 index 0000000000000..4a5f3b2a90751 --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/ca1877.vb @@ -0,0 +1,31 @@ +Imports System.IO + +Class ViolationExample + ' + Public Function GetFilePath(folder As String, subfolder As String, filename As String) As String + ' Violation. + Dim temp As String = Path.Combine(folder, subfolder) + Return Path.Combine(temp, filename) + End Function + + Public Function GetLogPath(baseDir As String, [date] As String, category As String) As String + ' Violation. + Return Path.Join(Path.Join(baseDir, [date]), category) + End Function + ' +End Class + +Class FixExample + ' + Public Function GetFilePath(folder As String, subfolder As String, filename As String) As String + ' No violation. + Return Path.Combine(folder, subfolder, filename) + End Function + + Public Function GetLogPath(baseDir As String, [date] As String, category As String) As String + ' No violation. + Return Path.Join(baseDir, [date], category) + End Function + ' +End Class + diff --git a/docs/navigate/tools-diagnostics/toc.yml b/docs/navigate/tools-diagnostics/toc.yml index c6a85a983e25b..302c82cd9adda 100644 --- a/docs/navigate/tools-diagnostics/toc.yml +++ b/docs/navigate/tools-diagnostics/toc.yml @@ -3287,6 +3287,8 @@ items: href: ../../fundamentals/code-analysis/quality-rules/ca1874.md - name: CA1875 href: ../../fundamentals/code-analysis/quality-rules/ca1875.md + - name: CA1877 + href: ../../fundamentals/code-analysis/quality-rules/ca1877.md - name: SingleFile rules items: - name: Overview From 282b6486f431536d57754a6e7b8e9c17474b0b2d Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Thu, 6 Nov 2025 22:45:42 +0100 Subject: [PATCH 13/38] Fix note syntax in MSTEST0006 doc (#49653) --- docs/core/testing/mstest-analyzers/mstest0006.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/testing/mstest-analyzers/mstest0006.md b/docs/core/testing/mstest-analyzers/mstest0006.md index 9454fd1c7164d..b82dffc9b8d78 100644 --- a/docs/core/testing/mstest-analyzers/mstest0006.md +++ b/docs/core/testing/mstest-analyzers/mstest0006.md @@ -27,7 +27,7 @@ dev_langs: | **Introduced in version** | 3.2.0 | | **Is there a code fix** | Yes, starting with 3.7.0 | -> [NOTE] +> [!NOTE] > This analyzer is no longer relevant for MSTest 4 as the attribute was removed. ## Cause From ebc95c0f36c1cf0b88e69097829275276eda5b7a Mon Sep 17 00:00:00 2001 From: "Andy (Steve) De George" <67293991+adegeo@users.noreply.github.com> Date: Thu, 6 Nov 2025 14:43:18 -0800 Subject: [PATCH 14/38] Remove note about GitHub Copilot app modernization agent (#49656) Removed important note regarding GitHub Copilot app modernization agent in Visual Studio 2022. --- .../porting/github-copilot-app-modernization/overview.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/core/porting/github-copilot-app-modernization/overview.md b/docs/core/porting/github-copilot-app-modernization/overview.md index 0d00dc928728d..0925aa5c4c1c7 100644 --- a/docs/core/porting/github-copilot-app-modernization/overview.md +++ b/docs/core/porting/github-copilot-app-modernization/overview.md @@ -27,15 +27,6 @@ With this assistant, you can: - Fix issues and apply best practices for cloud migration. - Validate that your app builds and tests successfully. -> [!IMPORTANT] -> Starting with Visual Studio 2022 17.14.16, the GitHub Copilot app modernization agent is included with Visual Studio. If you're using an older version of Visual Studio 2022, upgrade to the latest release. -> -> If you installed any of the following extensions published by Microsoft, uninstall them before using the version now included in Visual Studio: -> -> - .NET Upgrade Assistant -> - GitHub Copilot App Modernization – Upgrade for .NET -> - Azure Migrate Application and Code Assessment for .NET - ## Provide feedback Feedback is important to Microsoft and the efficiency of this agent. Use the [Suggest a feature](/visualstudio/ide/suggest-a-feature) and [Report a problem](/visualstudio/ide/report-a-problem) features of Visual Studio to provide feedback. From 0df9a838c7a49ec846fb333093f2911d21083390 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 7 Nov 2025 06:31:48 -0800 Subject: [PATCH 15/38] Update package index with latest published versions (#49658) --- docs/azure/includes/dotnet-all.md | 6 +++--- docs/azure/includes/dotnet-new.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 716b318b12440..36537432566d4 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -28,7 +28,7 @@ | Conversational Language Understanding | NuGet [1.1.0](https://www.nuget.org/packages/Azure.AI.Language.Conversations/1.1.0)
NuGet [2.0.0-beta.4](https://www.nuget.org/packages/Azure.AI.Language.Conversations/2.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.Language.Conversations-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Language.Conversations_1.1.0/sdk/cognitivelanguage/Azure.AI.Language.Conversations/)
GitHub [2.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Language.Conversations_2.0.0-beta.4/sdk/cognitivelanguage/Azure.AI.Language.Conversations/) | | Conversations Authoring | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Language.Conversations.Authoring/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Language.Conversations.Authoring-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Language.Conversations.Authoring_1.0.0-beta.2/sdk/cognitivelanguage/Azure.AI.Language.Conversations.Authoring/) | | Core - Client - AMQP | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Core.Amqp/1.3.1) | [docs](/dotnet/api/overview/azure/Core.Amqp-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core.Amqp_1.3.1/sdk/core/Azure.Core.Amqp/) | -| Core - Client - Core | NuGet [1.49.0](https://www.nuget.org/packages/Azure.Core/1.49.0) | [docs](/dotnet/api/overview/azure/Core-readme) | GitHub [1.49.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core_1.49.0/sdk/core/Azure.Core/) | +| Core - Client - Core | NuGet [1.50.0](https://www.nuget.org/packages/Azure.Core/1.50.0) | [docs](/dotnet/api/overview/azure/Core-readme) | GitHub [1.50.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core_1.50.0/sdk/core/Azure.Core/) | | Core - Client - Core | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Core.Expressions.DataFactory/1.0.0) | [docs](/dotnet/api/overview/azure/Core.Expressions.DataFactory-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core.Expressions.DataFactory_1.0.0/sdk/core/Azure.Core.Expressions.DataFactory/) | | Core Newtonsoft Json | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.Core.NewtonsoftJson/2.0.0) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.Core.NewtonsoftJson-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Core.NewtonsoftJson_2.0.0/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/) | | Core WCF Storage Queues | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.CoreWCF.Azure.StorageQueues/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.CoreWCF.Azure.StorageQueues-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.CoreWCF.Azure.StorageQueues_1.0.0-beta.1/sdk/extension-wcf/Microsoft.CoreWCF.Azure.StorageQueues/) | @@ -594,9 +594,9 @@ | Microsoft.Azure.Functions.Worker.Grpc | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Grpc/2.0.0)
NuGet [2.50.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Grpc/2.50.0-preview2) | | | | Microsoft.Azure.Functions.Worker.ItemTemplates | NuGet [4.0.5303](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates/4.0.5303) | | | | Microsoft.Azure.Functions.Worker.ProjectTemplates | NuGet [4.0.5303](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ProjectTemplates/4.0.5303) | | | -| Microsoft.Azure.Functions.Worker.Sdk | NuGet [2.0.5](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk/2.0.5) | | | +| Microsoft.Azure.Functions.Worker.Sdk | NuGet [2.0.6](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk/2.0.6) | | | | Microsoft.Azure.Functions.Worker.Sdk.Analyzers | NuGet [1.2.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk.Analyzers/1.2.2) | | | -| Microsoft.Azure.Functions.Worker.Sdk.Generators | NuGet [1.3.5](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk.Generators/1.3.5) | | | +| Microsoft.Azure.Functions.Worker.Sdk.Generators | NuGet [1.3.6](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk.Generators/1.3.6) | | | | Microsoft.Azure.WebJobs.CosmosDb.ChangeProcessor | NuGet [1.0.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.CosmosDb.ChangeProcessor/1.0.4) | | | | Microsoft.Azure.WebJobs.Extensions.Kusto | NuGet [1.0.13-Preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Kusto/1.0.13-Preview) | | | | Microsoft.Azure.WebJobs.Extensions.Rpc | NuGet [3.0.42](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Rpc/3.0.42) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 68db1b766a7df..0160aff9f81cb 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -30,7 +30,7 @@ | Conversational Language Understanding | NuGet [1.1.0](https://www.nuget.org/packages/Azure.AI.Language.Conversations/1.1.0)
NuGet [2.0.0-beta.4](https://www.nuget.org/packages/Azure.AI.Language.Conversations/2.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.Language.Conversations-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Language.Conversations_1.1.0/sdk/cognitivelanguage/Azure.AI.Language.Conversations/)
GitHub [2.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Language.Conversations_2.0.0-beta.4/sdk/cognitivelanguage/Azure.AI.Language.Conversations/) | | Conversations Authoring | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Language.Conversations.Authoring/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Language.Conversations.Authoring-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Language.Conversations.Authoring_1.0.0-beta.2/sdk/cognitivelanguage/Azure.AI.Language.Conversations.Authoring/) | | Core - Client - AMQP | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Core.Amqp/1.3.1) | [docs](/dotnet/api/overview/azure/Core.Amqp-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core.Amqp_1.3.1/sdk/core/Azure.Core.Amqp/) | -| Core - Client - Core | NuGet [1.49.0](https://www.nuget.org/packages/Azure.Core/1.49.0) | [docs](/dotnet/api/overview/azure/Core-readme) | GitHub [1.49.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core_1.49.0/sdk/core/Azure.Core/) | +| Core - Client - Core | NuGet [1.50.0](https://www.nuget.org/packages/Azure.Core/1.50.0) | [docs](/dotnet/api/overview/azure/Core-readme) | GitHub [1.50.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core_1.50.0/sdk/core/Azure.Core/) | | Core - Client - Core | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Core.Expressions.DataFactory/1.0.0) | [docs](/dotnet/api/overview/azure/Core.Expressions.DataFactory-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core.Expressions.DataFactory_1.0.0/sdk/core/Azure.Core.Expressions.DataFactory/) | | Core Newtonsoft Json | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.Core.NewtonsoftJson/2.0.0) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.Core.NewtonsoftJson-readme) | GitHub [2.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Core.NewtonsoftJson_2.0.0/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/) | | Core WCF Storage Queues | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.CoreWCF.Azure.StorageQueues/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.CoreWCF.Azure.StorageQueues-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.CoreWCF.Azure.StorageQueues_1.0.0-beta.1/sdk/extension-wcf/Microsoft.CoreWCF.Azure.StorageQueues/) | From 78e27f3a090bf93875828391b1dde550b7840814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Pir=C3=B3g?= Date: Fri, 7 Nov 2025 15:40:39 +0100 Subject: [PATCH 16/38] Vb.net: Fix typo in enum member syntax description (#49666) - Was [] member name [ = initializer ], - Should be [] membername [ = initializer ], - Reason: `membername` is a single identifier; later in the document it is referred to as `membername` --- .../language-reference/statements/enum-statement.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/visual-basic/language-reference/statements/enum-statement.md b/docs/visual-basic/language-reference/statements/enum-statement.md index 0a4a89cbcbc55..ae0fcfe765e5f 100644 --- a/docs/visual-basic/language-reference/statements/enum-statement.md +++ b/docs/visual-basic/language-reference/statements/enum-statement.md @@ -66,7 +66,7 @@ End Enum Required. List of member constants being declared in this statement. Multiple members appear on individual source code lines. - Each `member` has the following syntax and parts: `[] member name [ = initializer ]` + Each `member` has the following syntax and parts: `[] membername [ = initializer ]` |Part|Description| |---|---| From 7bb6a1adfeddc0fb5e635bf4ed74ba45622cd833 Mon Sep 17 00:00:00 2001 From: Nigusu Solomon Yenework <59111203+Nigusu-Allehu@users.noreply.github.com> Date: Fri, 7 Nov 2025 10:12:00 -0800 Subject: [PATCH 17/38] Add documentation for dotnet package download command (#49659) --- docs/core/tools/dotnet-package-download.md | 89 ++++++++++++++++++++++ docs/core/tools/index.md | 1 + docs/navigate/tools-diagnostics/toc.yml | 2 + 3 files changed, 92 insertions(+) create mode 100644 docs/core/tools/dotnet-package-download.md diff --git a/docs/core/tools/dotnet-package-download.md b/docs/core/tools/dotnet-package-download.md new file mode 100644 index 0000000000000..d549f8f2f9028 --- /dev/null +++ b/docs/core/tools/dotnet-package-download.md @@ -0,0 +1,89 @@ +--- +title: dotnet package download command +description: Learn about the 'dotnet package download' command that downloads a NuGet package. +author: Nigusu-Allehu +ms.date: 11/06/2025 +ai-usage: ai-assisted +--- +# dotnet package download + +> Applies to: ✔️ .NET 10 SDK and later versions. + +## Name + +`dotnet package download` — Download one or more NuGet packages to disk. + +## Synopsis + +``` +dotnet package download [...] + [--output ] + [--configfile ] + [--prerelease] + [--source ] + [--allow-insecure-connections] + [--interactive] + [--verbosity ] + +dotnet package download -h|--help +``` + +## Description + +`dotnet package download` downloads NuGet packages to a local directory. It **does not** add or update `PackageReference` entries in project files and **does not** build or restore a project. +By default, the command downloads only the packages you specify (no transitive dependencies) to the current working directory. + +## Arguments + +* **`packages`** + + One or more package IDs to download. + Each package can optionally include a version with `@`. + If a package version isn't specified, the latest version of the package is downloaded. + For example, `dotnet package download Contoso.Utilities` or `dotnet package download Contoso.Utilities@3.2.1`. + +## Options + +* **`--allow-insecure-connections`** + + Allows downloading from HTTP sources. Without this flag, insecure sources cause the command to error per [HTTPS-everywhere](https://aka.ms/nuget-https-everywhere) guidance. + +* **`--configfile `** + + Path to a NuGet.config to use. + +* **`--interactive`** + + Enables interactive authentication if required. + +* **`-o, --output `** + + Directory where the package will be placed. Defaults to the current working directory. + +* **`--prerelease`** + + Allows downloading prerelease versions. + +* **`-s --source `** + + Specifies the NuGet package source to use. + +* **`-v, --verbosity `** + + Set the verbosity level of the command. Allowed values are `q[uiet]`, `m[inimal]`, `n[ormal]`, `d[etailed]`, and `diag[nostic]`. + +[!INCLUDE [help](../../../includes/cli-help.md)] + +## Examples + +### Download a single package at a specific version + +```ps1 +dotnet package download Contoso@13.0.3 --output My/Destination/For/packages +``` + +### Download multiple packages to a custom folder + +```ps1 +dotnet package download Contoso@3.1.2 Contoso.Utility@6.12.0 --output My/Destination/For/packages +``` diff --git a/docs/core/tools/index.md b/docs/core/tools/index.md index 5998715ea5d5e..fb36452000943 100644 --- a/docs/core/tools/index.md +++ b/docs/core/tools/index.md @@ -74,6 +74,7 @@ The following commands are installed by default: ### Project modification commands - [`package add`](dotnet-package-add.md) +- [`package download`](dotnet-package-download.md) - [`package list`](dotnet-package-list.md) - [`package remove`](dotnet-package-remove.md) - [`package search`](dotnet-package-search.md) diff --git a/docs/navigate/tools-diagnostics/toc.yml b/docs/navigate/tools-diagnostics/toc.yml index 302c82cd9adda..c504a4d148d37 100644 --- a/docs/navigate/tools-diagnostics/toc.yml +++ b/docs/navigate/tools-diagnostics/toc.yml @@ -182,6 +182,8 @@ items: items: - name: dotnet package add href: ../../core/tools/dotnet-package-add.md + - name: dotnet package download + href: ../../core/tools/dotnet-package-download.md - name: dotnet package list href: ../../core/tools/dotnet-package-list.md - name: dotnet package remove From c969230fe887a61c4c7070134c166544f7d4b50c Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 7 Nov 2025 10:29:33 -0800 Subject: [PATCH 18/38] Update package index with latest published versions (#49668) --- docs/azure/includes/dotnet-all.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 36537432566d4..05ba167f03daa 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -417,13 +417,13 @@ | System Net Client Model | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/System.Net.ClientModel/1.0.0-beta.1) | | | | Unknown Display Name | NuGet [0.13.0](https://www.nuget.org/packages/Azure.Iot.Operations.Connector/0.13.0) | | | | Unknown Display Name | NuGet [0.1.0](https://www.nuget.org/packages/Azure.Iot.Operations.Templates/0.1.0) | | | -| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp/2.0.0-beta.1) | | | -| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/2.0.0-beta.1) | | | -| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-x64/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp.linux-x64/2.0.0-beta.1) | | | -| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/2.0.0-beta.1) | | | -| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-x64/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp.osx-x64/2.0.0-beta.1) | | | -| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-arm64/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp.win-arm64/2.0.0-beta.1) | | | -| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-x64/1.0.0)
NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Mcp.win-x64/2.0.0-beta.1) | | | +| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp/1.0.0)
NuGet [2.0.0-beta.2](https://www.nuget.org/packages/Azure.Mcp/2.0.0-beta.2) | | | +| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/1.0.0)
NuGet [2.0.0-beta.2](https://www.nuget.org/packages/Azure.Mcp.linux-arm64/2.0.0-beta.2) | | | +| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.linux-x64/1.0.0)
NuGet [2.0.0-beta.2](https://www.nuget.org/packages/Azure.Mcp.linux-x64/2.0.0-beta.2) | | | +| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/1.0.0)
NuGet [2.0.0-beta.2](https://www.nuget.org/packages/Azure.Mcp.osx-arm64/2.0.0-beta.2) | | | +| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.osx-x64/1.0.0)
NuGet [2.0.0-beta.2](https://www.nuget.org/packages/Azure.Mcp.osx-x64/2.0.0-beta.2) | | | +| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-arm64/1.0.0)
NuGet [2.0.0-beta.2](https://www.nuget.org/packages/Azure.Mcp.win-arm64/2.0.0-beta.2) | | | +| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Mcp.win-x64/1.0.0)
NuGet [2.0.0-beta.2](https://www.nuget.org/packages/Azure.Mcp.win-x64/2.0.0-beta.2) | | | | Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Monitor.Query.Logs/1.0.0) | | | | Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Monitor.Query.Metrics/1.0.0) | | | | Unknown Display Name | NuGet [0.1.4-preview.2](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Aot/0.1.4-preview.2) | | | From 04e66f234d0fddcf9fef4eed415ceb497f439a06 Mon Sep 17 00:00:00 2001 From: alexwolfmsft <93200798+alexwolfmsft@users.noreply.github.com> Date: Fri, 7 Nov 2025 14:25:30 -0500 Subject: [PATCH 19/38] Refactor more language agnostic content into includes (#49651) * Refactor more language agnostic content into includes Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --------- Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .../local-development-broker.md | 57 ++----------------- .../azure/sdk/includes/broker-assign-roles.md | 13 +++++ .../sdk/includes/broker-configure-app.md | 34 +++++++++++ docs/azure/sdk/includes/broker-intro.md | 14 +++++ docs/azure/sdk/includes/broker-linux.md | 6 ++ docs/azure/sdk/includes/broker-mac.md | 6 ++ docs/azure/sdk/includes/broker-windows.md | 8 +++ 7 files changed, 87 insertions(+), 51 deletions(-) create mode 100644 docs/azure/sdk/includes/broker-assign-roles.md create mode 100644 docs/azure/sdk/includes/broker-configure-app.md create mode 100644 docs/azure/sdk/includes/broker-intro.md create mode 100644 docs/azure/sdk/includes/broker-linux.md create mode 100644 docs/azure/sdk/includes/broker-mac.md create mode 100644 docs/azure/sdk/includes/broker-windows.md diff --git a/docs/azure/sdk/authentication/local-development-broker.md b/docs/azure/sdk/authentication/local-development-broker.md index 80a8b3a2f06d6..fb0cf004f2479 100644 --- a/docs/azure/sdk/authentication/local-development-broker.md +++ b/docs/azure/sdk/authentication/local-development-broker.md @@ -9,74 +9,29 @@ zone_pivot_groups: operating-systems-set-one # Authenticate .NET apps to Azure services during local development using brokered authentication -Brokered authentication collects user credentials using the system authentication broker to authenticate an app with . A system authentication broker is an app running on a user's machine that manages the authentication handshakes and token maintenance for all connected accounts. - -Brokered authentication offers the following benefits: - -- **Enables Single Sign-On (SSO):** Enables apps to simplify how users authenticate with Microsoft Entra ID and protects Microsoft Entra ID refresh tokens from exfiltration and misuse. -- **Enhanced security:** Many security enhancements are delivered with the broker, without needing to update the app logic. -- **Enhanced feature support:** With the help of the broker, developers can access rich OS and service capabilities. -- **System integration:** Applications that use the broker plug-and-play with the built-in account picker, allowing the user to quickly pick an existing account instead of reentering the same credentials over and over. -- **Token Protection:** Ensures that the refresh tokens are device bound and enables apps to acquire device bound access tokens. See [Token Protection](/azure/active-directory/conditional-access/concept-token-protection). +[!INCLUDE [broker-intro](../includes/broker-intro.md)] :::zone target="docs" pivot="os-windows" -Windows provides an authentication broker called [Web Account Manager (WAM)](/entra/msal/dotnet/acquiring-tokens/desktop-mobile/wam). WAM enables identity providers such as Microsoft Entra ID to natively plug into the OS and provide secure login services to apps. Brokered authentication enables the app for all operations allowed by the interactive login credentials. - -Personal Microsoft accounts and work or school accounts are supported. On supported Windows versions, the default browser-based UI is replaced with a smoother authentication experience, similar to built-in Windows apps. +[!INCLUDE [broker-windows](../includes/broker-windows.md)] :::zone-end :::zone target="docs" pivot="os-macos" -macOS doesn't natively include a built-in authentication broker. Brokered authentication is supported via the `Azure.Identity.Broker` library, which uses platform-specific mechanisms and may integrate with apps like Microsoft Company Portal when devices are managed. For more information, see [Microsoft Enterprise SSO plug-in for Apple devices](/entra/identity-platform/apple-sso-plugin). +[!INCLUDE [broker-mac](../includes/broker-mac.md)] :::zone-end :::zone target="docs" pivot="os-linux" -Linux uses [Microsoft single sign-on for Linux](/entra/identity/devices/sso-linux) as its authentication broker. +[!INCLUDE [broker-linux](../includes/broker-linux.md)] :::zone-end -## Configure the app for brokered authentication - -To enable brokered authentication in your application, follow these steps: - -1. In the [Azure portal](https://portal.azure.com), navigate to **Microsoft Entra ID** and select **App registrations** on the left-hand menu. -1. Select the registration for your app, then select **Authentication**. -1. Add the appropriate redirect URI to your app registration via a platform configuration: - 1. Under **Platform configurations**, select **+ Add a platform**. - 1. Under **Configure platforms**, select the tile for your application type (platform) to configure its settings, such as **mobile and desktop applications**. - 1. In **Custom redirect URIs**, enter the following redirect URI for your platform: - - | Platform | Redirect URI | - |-------------|-----------------------------------------------------------------------------------------------------------------------| - | Windows 10+ or WSL | `ms-appx-web://Microsoft.AAD.BrokerPlugin/{your_client_id}` | - | macOS | `msauth.com.msauth.unsignedapp://auth` for unsigned apps
`msauth.{bundle_id}://auth` for signed apps | - | Linux | `https://login.microsoftonline.com/common/oauth2/nativeclient` | - - Replace `{your_client_id}` or `{bundle_id}` with the **Application (client) ID** from the app registration's **Overview** pane. - - 1. Select **Configure**. - - To learn more, see [Add a redirect URI to an app registration](/entra/identity-platform/quickstart-register-app#add-a-redirect-uri). - -1. Back on the **Authentication** pane, under **Advanced settings**, select **Yes** for **Allow public client flows**. -1. Select **Save** to apply the changes. -1. To authorize the application for specific resources, navigate to the resource in question, select **API Permissions**, and enable **Microsoft Graph** and other resources you want to access. - - > [!IMPORTANT] - > You must also be the admin of your tenant to grant consent to your application when you sign in for the first time. - -## Assign roles - -To run your app code successfully with brokered authentication, grant your user account permissions using [Azure role-based access control (RBAC)](/azure/role-based-access-control/overview). Assign an appropriate role to your user account for the relevant Azure service. For example: - -- **Azure Blob Storage**: Assign the **Storage Account Data Contributor** role. -- **Azure Key Vault**: Assign the **Key Vault Secrets Officer** role. +[!INCLUDE [broker-configure-app](../includes/broker-configure-app.md)] -If an app is specified, it must have API permissions set for **user_impersonation Access Azure Storage** (step 6 in the previous section). This API permission allows the app to access Azure storage on behalf of the signed-in user after consent is granted during sign-in. +[!INCLUDE [broker-assign-roles](../includes/broker-assign-roles.md)] ## Implement the code diff --git a/docs/azure/sdk/includes/broker-assign-roles.md b/docs/azure/sdk/includes/broker-assign-roles.md new file mode 100644 index 0000000000000..0904833ce7086 --- /dev/null +++ b/docs/azure/sdk/includes/broker-assign-roles.md @@ -0,0 +1,13 @@ +--- +ms.topic: include +ms.date: 03/19/2025 +--- + +## Assign roles + +To run your app code successfully with brokered authentication, grant your user account permissions using [Azure role-based access control (RBAC)](/azure/role-based-access-control/overview). Assign an appropriate role to your user account for the relevant Azure service. For example: + +- **Azure Blob Storage**: Assign the **Storage Account Data Contributor** role. +- **Azure Key Vault**: Assign the **Key Vault Secrets Officer** role. + +If an app is specified, it must have API permissions set for **user_impersonation Access Azure Storage** (step 6 in the previous section). This API permission allows the app to access Azure storage on behalf of the signed-in user after consent is granted during sign-in. diff --git a/docs/azure/sdk/includes/broker-configure-app.md b/docs/azure/sdk/includes/broker-configure-app.md new file mode 100644 index 0000000000000..77ce644c20215 --- /dev/null +++ b/docs/azure/sdk/includes/broker-configure-app.md @@ -0,0 +1,34 @@ +--- +ms.topic: include +ms.date: 03/19/2025 +--- + +## Configure the app for brokered authentication + +To enable brokered authentication in your application, follow these steps: + +1. In the [Azure portal](https://portal.azure.com), navigate to **Microsoft Entra ID** and select **App registrations** on the left-hand menu. +1. Select the registration for your app, then select **Authentication**. +1. Add the appropriate redirect URI to your app registration via a platform configuration: + 1. Under **Platform configurations**, select **+ Add a platform**. + 1. Under **Configure platforms**, select the tile for your application type (platform) to configure its settings, such as **mobile and desktop applications**. + 1. In **Custom redirect URIs**, enter the following redirect URI for your platform: + + | Platform | Redirect URI | + |-------------|-----------------------------------------------------------------------------------------------------------------------| + | Windows 10+ or WSL | `ms-appx-web://Microsoft.AAD.BrokerPlugin/{your_client_id}` | + | macOS | `msauth.com.msauth.unsignedapp://auth` for unsigned apps
`msauth.{bundle_id}://auth` for signed apps | + | Linux | `https://login.microsoftonline.com/common/oauth2/nativeclient` | + + Replace `{your_client_id}` or `{bundle_id}` with the **Application (client) ID** from the app registration's **Overview** pane. + + 1. Select **Configure**. + + To learn more, see [Add a redirect URI to an app registration](/entra/identity-platform/quickstart-register-app#add-a-redirect-uri). + +1. Back on the **Authentication** pane, under **Advanced settings**, select **Yes** for **Allow public client flows**. +1. Select **Save** to apply the changes. +1. To authorize the application for specific resources, navigate to the resource in question, select **API Permissions**, and enable **Microsoft Graph** and other resources you want to access. + + > [!IMPORTANT] + > You must also be the admin of your tenant to grant consent to your application when you sign in for the first time. diff --git a/docs/azure/sdk/includes/broker-intro.md b/docs/azure/sdk/includes/broker-intro.md new file mode 100644 index 0000000000000..2ac265642c74d --- /dev/null +++ b/docs/azure/sdk/includes/broker-intro.md @@ -0,0 +1,14 @@ +--- +ms.topic: include +ms.date: 04/25/2025 +--- + +Brokered authentication collects user credentials using the system authentication broker to authenticate an app. A system authentication broker is an app running on a user's machine that manages the authentication handshakes and token maintenance for all connected accounts. + +Brokered authentication offers the following benefits: + +- **Enables Single Sign-On (SSO):** Enables apps to simplify how users authenticate with Microsoft Entra ID and protects Microsoft Entra ID refresh tokens from exfiltration and misuse. +- **Enhanced security:** Many security enhancements are delivered with the broker, without needing to update the app logic. +- **Enhanced feature support:** With the help of the broker, developers can access rich OS and service capabilities. +- **System integration:** Applications that use the broker plug-and-play with the built-in account picker, allowing the user to quickly pick an existing account instead of re-entering the same credentials over and over. +- **Token Protection:** Ensures that the refresh tokens are device bound and enables apps to acquire device bound access tokens. For more information, see [Token Protection](/azure/active-directory/conditional-access/concept-token-protection). diff --git a/docs/azure/sdk/includes/broker-linux.md b/docs/azure/sdk/includes/broker-linux.md new file mode 100644 index 0000000000000..87a5fa1de997c --- /dev/null +++ b/docs/azure/sdk/includes/broker-linux.md @@ -0,0 +1,6 @@ +--- +ms.topic: include +ms.date: 04/25/2025 +--- + +Linux uses [Microsoft single sign-on for Linux](/entra/identity/devices/sso-linux) as its authentication broker. diff --git a/docs/azure/sdk/includes/broker-mac.md b/docs/azure/sdk/includes/broker-mac.md new file mode 100644 index 0000000000000..93b027043a9ad --- /dev/null +++ b/docs/azure/sdk/includes/broker-mac.md @@ -0,0 +1,6 @@ +--- +ms.topic: include +ms.date: 04/25/2025 +--- + +macOS doesn't natively include a built-in authentication broker. The Azure Identity client library implements brokered authentication features using platform-specific mechanisms and can integrate with apps like Microsoft Company Portal when devices are managed. For more information, see [Microsoft Enterprise SSO plug-in for Apple devices](/entra/identity-platform/apple-sso-plugin). diff --git a/docs/azure/sdk/includes/broker-windows.md b/docs/azure/sdk/includes/broker-windows.md new file mode 100644 index 0000000000000..542b09c88a54d --- /dev/null +++ b/docs/azure/sdk/includes/broker-windows.md @@ -0,0 +1,8 @@ +--- +ms.topic: include +ms.date: 04/25/2025 +--- + +Windows provides an authentication broker called [Web Account Manager (WAM)](/entra/msal/dotnet/acquiring-tokens/desktop-mobile/wam). WAM enables identity providers such as Microsoft Entra ID to natively plug into the OS and provide secure login services to apps. Brokered authentication enables the app for all operations allowed by the interactive login credentials. + +Personal Microsoft accounts and work or school accounts are supported. On supported Windows versions, the default browser-based UI is replaced with a smoother authentication experience, similar to built-in Windows apps. From 871025ff8b9aadfc38c4008730a928941568596a Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Fri, 7 Nov 2025 15:01:14 -0500 Subject: [PATCH 20/38] Add errors for existing C# 14 themes (#49669) * Add errors for existing C# 14 themes Add all newly created diagnostics that map to existing consolidated error files. * Update docs/csharp/language-reference/compiler-messages/array-declaration-errors.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Edit pass on array errors. After adding the final C# 14 updates, perform an edit pass to match the current format. * edit pass on extension declarations Add final errors introduced in C# 14 for extensions. Perform an edit pass to match the improved format. * Edit pass and update dates After adding the final diagnostics for C# 14, update this file to match the more recent style. * Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .../array-declaration-errors.md | 197 +++++++++++------- .../extension-declarations.md | 107 ++++++---- .../feature-version-errors.md | 6 + .../overloaded-operator-errors.md | 111 +++++++--- .../pattern-matching-warnings.md | 71 +++++-- docs/csharp/language-reference/toc.yml | 11 +- ...n-t-have-specifics-on-this-csharp-error.md | 3 - 7 files changed, 331 insertions(+), 175 deletions(-) diff --git a/docs/csharp/language-reference/compiler-messages/array-declaration-errors.md b/docs/csharp/language-reference/compiler-messages/array-declaration-errors.md index 211d07ae2b64f..51fc3bac11d09 100644 --- a/docs/csharp/language-reference/compiler-messages/array-declaration-errors.md +++ b/docs/csharp/language-reference/compiler-messages/array-declaration-errors.md @@ -42,6 +42,7 @@ f1_keywords: - "CS9214" - "CS9215" - "CS9222" + - "CS9332" helpviewer_keywords: - "CS0022" - "CS0178" @@ -83,7 +84,9 @@ helpviewer_keywords: - "CS9214" - "CS9215" - "CS9222" -ms.date: 11/02/2023 + - "CS9332" +ms.date: 11/07/2025 +ai-usage: ai-assisted --- # Resolve errors and warnings in array and collection declarations and initialization expressions @@ -125,6 +128,7 @@ That's by design. The text closely matches the text of the compiler error / warn - [**CS9214**](#invalid-collection-initializer): *Collection expression type must have an applicable constructor that can be called with no arguments.* - [**CS9215**](#invalid-collection-initializer): *Collection expression type 'type' must have an instance or extension method 'Add' that can be called with a single argument.* - [**CS9222**](#invalid-collection-initializer): *Collection initializer results in an infinite chain of instantiations of collection 'type'.* +- [**CS9332**](#invalid-collection-initializer): *Cannot use '..' spread operator in the filter expression of a catch clause.* In addition, the following warnings are covered in this article: @@ -135,75 +139,62 @@ In addition, the following warnings are covered in this article: - [**CS0251**](#invalid-array-element-access): *Indexing an array with a negative index (array indices always start at zero)* - [**CS9208**](#invalid-collection-initializer): *Collection expression may incur unexpected heap allocations. Consider explicitly creating an array, then converting to the final type to make the allocation explicit.* - [**CS9209**](#invalid-collection-initializer): *Collection expression may incur unexpected heap allocations due to use of '`..`' spreads. Consider explicitly creating an array, then converting to the final type to make the allocation explicit.* +- [**CS9332**](#invalid-collection-initializer): *Cannot use '..' spread operator in the filter expression of a catch clause.* -You can learn more about arrays, collection initializers and collection expressions in the following articles: +## Invalid array element access + +- **CS0022**: *Wrong number of indices inside [], expected 'number'* +- **CS0251**: *Indexing an array with a negative index (array indices always start at zero)* -- [Arrays](../builtin-types/arrays.md) -- [Object and Collection Initializers](../../programming-guide/classes-and-structs/object-and-collection-initializers.md) -- [Collection expressions](../operators/collection-expressions.md). +To access array elements correctly, follow these indexing rules. For more information, see [Arrays](../builtin-types/arrays.md). -## Invalid collection initializer +- Specify the same number of indices as declared dimensions (**CS0022**). A one-dimensional array needs one index; a three-dimensional array needs three indices. +- Use only non-negative integers for array indices (**CS0251**). Array indices always start at zero. -The following errors indicate that the code generated by the compiler for a collection initializer is invalid: +## Invalid collection initializer - **CS0747**: *Invalid initializer member declarator.* -- **CS1063**: *The best overloaded Add method for the collection initializer element is obsolete.* - **CS1920**: *Element initializer cannot be empty.* - **CS1921**: *The best overloaded method match has wrong signature for the initializer element. The initializable `Add` must be an accessible instance method.* +- **CS1922**: *Cannot initialize type 'type' with a collection initializer because 'type' doesn't implement 'System.Collections.IEnumerable'.* +- **CS1925**: *Cannot initialize object of type 'type' with a collection initializer.* +- **CS1927**: *Warning: Ignoring /win32manifest for module because it only applies to assemblies* - **CS1950**: *The best overloaded Add method for the collection initializer has some invalid arguments.* - **CS1954**: *The best overloaded method match for the collection initializer element cannot be used. Collection initializer '`Add`' methods cannot have `ref` or `out` parameters.* - **CS9174**: *Cannot initialize type with a collection literal because the type is not constructible.* - **CS9176**: *There is no target type for the collection literal.* - **CS9203**: *A collection expression of this type cannot be used in this context because it may be exposed outside of the current scope.* -- **CS9210**: *This version of cannot be used with collection expressions.* -- **CS9212**: *Spread operator '`..`' cannot operate on variables of type 'type' because 'type' does not contain a public instance or extension definition for 'member'.* +- **CS9210**: *This version of can't be used with collection expressions.* +- **CS9212**: *Spread operator '`..`' cannot operate on variables of type 'type' because 'type' doesn't contain a public instance or extension definition for 'member'.* - **CS9213**: *Collection expression target 'type' has no element type.* - **CS9214**: *Collection expression type must have an applicable constructor that can be called with no arguments.* - **CS9215**: *Collection expression type 'type' must have an instance or extension method 'Add' that can be called with a single argument.* - **CS9222**: *Collection initializer results in an infinite chain of instantiations of collection 'type'.* +- **CS9332**: *Cannot use '..' spread operator in the filter expression of a catch clause.* -The compiler might also generate the following warning: +The compiler might also generate the following warnings: - **CS1062**: *The best overloaded Add method for the collection initializer element is obsolete.* +- **CS1063**: *The best overloaded Add method for the collection initializer element is obsolete.* - **CS1064**: *The best overloaded Add method for the collection initializer element is obsolete.* - **CS9208**: *Collection expression may incur unexpected heap allocations. Consider explicitly creating an array, then converting to the final type to make the allocation explicit.* - **CS9209**: *Collection expression may incur unexpected heap allocations due to use of '`..`' spreads. Consider explicitly creating an array, then converting to the final type to make the allocation explicit.* -The errors all indicate that the code generated by the compiler for a collection initializer is invalid. Check the following: - -- A collection initializer contains a sequence of elements. You can't mix setting properties on the collection instance with adding elements in the same initializer. -- A collection initializer that includes braces (`{` and `}`) can't be empty. -- The class must implement IEnumerable and have a public `Add` method. -- A conforming `Add` method must be accessible and take one parameter that is the same type as the collection elements. The parameter can't include the `ref` or `out` modifier. -- Overload resolution must pick one `Add` method as a better match. There can't be multiple matching methods that are equally good. -- Collection expressions can initialize explicitly typed variables of a collection type. If the variable isn't a collection or array type, or is implicitly typed (using `var`), a collection initializer can't be used. -- A `ref struct` type, like can't be initialized with a collection expression that may violate ref safety. -- A collection expression can't correctly initialize an using the current version. Use a different version of the runtime, or change the initialization expression. -- The spread operator (`..`) in **CS9212** requires the type to implement a suitable method (like `GetEnumerator`) to enumerate its elements. Ensure your type implements the required enumeration pattern or provides an extension method. -- **CS9213** occurs when the compiler can't determine what element type to use for the collection expression. This typically happens with custom collection types. Make sure your collection type properly exposes its element type through its type definition or implements appropriate collection interfaces. -- **CS9214** is generated when a collection expression tries to initialize a type that doesn't have a parameterless constructor. Collection expressions require a constructor that can be called with no arguments to create the instance before adding elements. -- **CS9215** happens when the collection type doesn't provide an `Add` method that accepts a single parameter of the element type. The `Add` method must be accessible (typically public) and accept exactly one argument that matches the collection's element type. -- **CS9222** indicates a circular dependency in collection initialization. This occurs when initializing a collection triggers the creation of another instance of the same collection type, which in turn requires initializing another instance, creating an infinite loop. Review your collection type's constructor and initialization logic to break the circular dependency. - -The warnings indicates that the collection expression, including any [spread elements](../operators/collection-expressions.md#spread-element) might allocate memory. Creating different storage and converting might be more efficient. - -## Invalid array initializer - -- **CS0623**: *Array initializers can only be used in a variable or field initializer. Try using a new expression instead.* -- **CS0846**: *A nested array initializer is expected* -- **CS1925**: *Cannot initialize object of type 'type' with a collection initializer.* - -These errors indicate that you've created an invalid initializer. The likely cause is unbalanced braces `{` and `}` around one or more elements or child arrays. Ensure that the initializing expression matches the number of arrays in a jagged array initialization, and that the braces are balanced. - -## Invalid array element access - -- **CS0022**: *Wrong number of indices inside [], expected 'number'* -- **CS0251**: *Indexing an array with a negative index (array indices always start at zero)* - -You access an element of an array by specifying the index for each axis declared in the array. The indices are between `[` and `]` after the array name. There are two rules for the array indices: - -1. You must specify the same number of indices as used in the array declaration. If the array has one dimension, you must specify one index. If the array has three dimensions, you must specify three indices. -1. All indices must be non-negative integers. +To create valid collection initializers, follow these rules. For more information, see [Collection expressions](../operators/collection-expressions.md). + +- Don't mix property initialization with element addition in the same initializer (**CS0747**). +- Include at least one element in collection initializers with braces (**CS1920**). +- Ensure the collection type implements `IEnumerable` (**CS1922**). +- Use collection initializers only with collection types (**CS1925**). +- Verify the `Add` method is accessible, takes one parameter matching the element type, and doesn't use `ref` or `out` modifiers (**CS1921**, **CS1954**). +- Resolve ambiguous `Add` method overloads (**CS1950**). +- Provide an explicit target type for collection expressions when the compiler can't infer it (**CS9176**, **CS9213**). +- Ensure the collection type is constructible with a parameterless constructor (**CS9174**, **CS9214**). +- Don't use `ref struct` types in collection expressions that may violate ref safety (**CS9203**). +- Update to a compatible runtime version for `ImmutableArray` collection expressions (**CS9210**). +- Implement enumeration patterns (like `GetEnumerator`) for spread operator support (**CS9212**). +- Avoid circular dependencies in collection initialization (**CS9222**). +- Don't use the spread operator in catch clause filter expressions (**CS9332**). ## Invalid array rank @@ -211,31 +202,37 @@ You access an element of an array by specifying the index for each axis declared - **CS0650**: *Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.* - **CS1552**: *Array type specifier, `[]`, must appear before parameter name* -An array declaration consists of the following tokens, in order: +To declare arrays correctly, follow the proper syntax order. For more information, see [Arrays](../builtin-types/arrays.md) and the [C# Language Specification](~/_csharpstandard/standard/arrays.md#177-array-initializers) section on array initializers. + +An array declaration consists of these tokens in order: -1. The type of the array elements. For example, `int`, `string`, or `SomeClassType`. -1. The array brackets, optionally including commas to represent multi dimensions. -1. The variable name. +1. The type of array elements (for example, `int`, `string`, or `SomeClassType`). +2. The array brackets, optionally including commas for multiple dimensions. +3. The variable name. -When an array initialization specifies the array dimensions, you can specify the following properties: +When specifying array dimensions, you can use: - A number of elements in braces (`{` and `}`) - Empty brackets - One or more commas enclosed in brackets -For example, the following are valid array declarations: +The following examples show valid array declarations: :::code language="csharp" source="./snippets/array-warnings/Program.cs" id="ArrayDeclarations"::: -For more information, see the C# specification ([C# Language Specification](~/_csharpstandard/standard/arrays.md#177-array-initializers)) section on array initializers. - ## Invalid array length - **CS0248**: *Cannot create an array with a negative size* -- **CS0270**: *Array size cannot be specified in a variable declaration (try initializing with a 'new' expression* +- **CS0270**: *Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)* - **CS1586**: *Array creation must have array size or array initializer* -The length of each dimension of an array must be specified as part of the array initialization, not its declaration. The length of each dimension must be positive. You can specify the length either by using a `new` expression to allocate the array, or using an array initializer to assign all the elements. The following example shows both mechanisms: +To create arrays with valid lengths, specify the size during initialization, not declaration. For more information, see [Arrays](../builtin-types/arrays.md). + +- Specify array length as part of initialization, not declaration (**CS0270**). +- Use only positive integers for array dimensions (**CS0248**). +- Provide either a size in a `new` expression or an array initializer (**CS1586**). + +The following example shows both mechanisms: :::code language="csharp" source="./snippets/array-warnings/Program.cs" id="ArrayInitializers"::: @@ -244,41 +241,97 @@ The length of each dimension of an array must be specified as part of the array - **CS0611**: *Array elements cannot be of type 'type'* - **CS0719**: *Array elements cannot be of static type* - **CS0820**: *Cannot assign array initializer to an implicitly typed local* -- **CS0826**: *No best type found for implicitly typed array.* +- **CS0826**: *No best type found for implicitly typed array* + +To use arrays with correct element types, follow these type restrictions. For more information, see [Implicitly typed local variables](../statements/declarations.md#implicitly-typed-local-variables) and [best common type](~/_csharpstandard/standard/expressions.md#126316-finding-the-best-common-type-of-a-set-of-expressions). -There are some types that cannot be used as the type of an array. These types include and . The type of an array can't be a `static` class, because instances of a `static` class can't be created. +- Don't use restricted types like and as array element types (**CS0611**). +- Don't use `static` classes as array element types because instances can't be created (**CS0719**). +- Initialize implicitly typed arrays with a `new` expression (**CS0820**). +- Ensure all elements in an implicitly typed array initializer have a best common type (**CS0826**). -You can declare arrays as [implicitly typed local variables](../statements/declarations.md#implicitly-typed-local-variables). The array must be initialized using a `new` expression. In addition, all elements in an array initializer must have a [best common type](~/_csharpstandard/standard/expressions.md#126316-finding-the-best-common-type-of-a-set-of-expressions). The following examples show how to declare an implicitly typed array: +The following examples show how to declare implicitly typed arrays: :::code language="csharp" source="./snippets/array-warnings/Program.cs" id="ImplicitInitializer"::: -You can ensure the best common type using any of the following techniques: +To ensure a best common type, use any of these techniques: - Give the array an explicit type. - Give all array elements the same type. -- Provide explicit casts on those elements that might be causing the problem. +- Provide explicit casts on elements that might be causing the problem. -## Invalid collection builder +## Invalid array initializer -The following errors indicate errors in your collection builder type: +- **CS0623**: *Array initializers can only be used in a variable or field initializer. Try using a new expression instead.* +- **CS0846**: *A nested array initializer is expected* +- **CS1925**: *Cannot initialize object of type 'type' with a collection initializer.* -- **CS9185**: *The `CollectionBuilderAttribute` builder type must be a non-generic class or struct.* -- **CS9186**: *The `CollectionBuilderAttribute` method name is invalid.* -- **CS9187**: *Could not find an accessible method with the expected signature: a static method with a single parameter of type `ReadOnlySpan`; and correct return type.* -- **CS9188**: *Type has a `CollectionBuilderAttribute` but no element type.* +These errors indicate invalid array initializer syntax. For more information, see [Arrays](../builtin-types/arrays.md). + +To create valid array initializers: -These errors indicate that your collection builder type needs modification. Remember the following rules: +- Use array initializers only in variable or field declarations (**CS0623**). Use a `new` expression in other contexts. +- Balance braces (`{` and `}`) around elements or child arrays (**CS0846**). +- Ensure the initializing expression matches the number of arrays in a jagged array initialization. +- Use collection initializers only with collection types, not with arrays or other types (**CS1925**). -- The collection type must have an iteration type. In other words, you can [`foreach`](~/_csharpstandard/standard/statements.md#1395-the-foreach-statement) the type as a collection. -- The collection builder type can't be a generic type. -- The method name specified on the must be a valid method name. For example, it can't be finalizer, or other name that contains invalid identifier characters. -- The collection builder method must be an accessible static method. It must return the collection type, and it must take a parameter of `ReadOnlySpan` where `T` matches the element type of the collection. +## Invalid collection builder + +- **CS9175**: *An expression tree may not contain a collection expression.* +- **CS9177**: *The 'CollectionBuilderAttribute' builder method return type must match collection type used in 'betterness'.* +- **CS9178**: *There is no target type for the natural type 'type'.* +- **CS9179**: *Collection expression type must have an applicable constructor that can be called with no arguments.* +- **CS9180**: *The 'CollectionBuilderAttribute' builder method must be a static method.* +- **CS9181**: *The 'CollectionBuilderAttribute' builder method parameter type must match parameter 'ReadOnlySpan<{0}>'* +- **CS9182**: *Invalid 'CollectionBuilderAttribute'. No matching '{0}' method found on builder type '{1}'.* +- **CS9183**: *The 'CollectionBuilderAttribute' method return type must be a non-abstract, non-interface type usable as a 'type'* +- **CS9185**: *A *static type* cannot be used as a type argument.* +- **CS9186**: *The `CollectionBuilderAttribute` method name is invalid.* +- **CS9187**: *Could not find an accessible 'Create' method with the expected signature: a static method with a single parameter of type 'ReadOnlySpan<{0}>' and return type '{1}'.* +- **CS9188**: *'scoped' cannot be used as a modifier on a collection expression type parameter.* +- **CS9190**: *The 'CollectionBuilderAttribute' method 'builderMethod' is inapplicable because it's generic.* +- **CS9192**: *Inline array conversions cannot be used with collection expressions.* +- **CS9193**: *Argument 'argument' may not be passed with the 'ref' keyword.* +- **CS9194**: *Argument 'argument' may not be passed with the 'out' keyword* +- **CS9195**: *Argument 'argument' may not be passed with the 'in' keyword* +- **CS9196**: *Feature 'collection expression' is not available in C# 'version'. Please use language version 'requiredVersion' or greater.* +- **CS9197**: *Feature 'inline arrays' is not available in C# 'version'. Please use language version 'requiredVersion' or greater.* +- **CS9198**: *Feature 'ref and unsafe in async and iterator methods' is not available in C# 'version'. Please use language version 'requiredVersion' or greater.* +- **CS9199**: *Feature 'collection expression' is not available in C# 'version'. Please use language version 'requiredVersion' or greater.* +- **CS9202**: *Feature 'ref readonly parameters' is not available in C# 'version'. Please use language version 'requiredVersion' or greater.* +- **CS9208**: *'nameof' operator cannot be used on an inline array access.* +- **CS9209**: *A ref-returning property 'property' cannot be used as a value argument.* +- **CS9211**: *The expression must be of type 'type' because it's being assigned by reference* +- **CS9212**: *Cannot use collection expression as the value in a fixed statement* +- **CS9217**: *A 'ref' local cannot be preserved across 'await' or 'yield' boundary.* +- **CS9218**: *'paramName' is a ref struct and cannot be the type of a parameter* +- **CS9221**: *The type 'type' may not be a ref struct or a type parameter allowing ref structs in order to use it as parameter 'parameter' in the generic type or method 'member'* +- **CS9223**: *A struct that contains 'ref' fields cannot be used in a collection expression.* +- **CS9228**: *Non-variable declaration of a ref struct is not allowed* +- **CS9232**: *Partial method declarations have signature differences.* +- **CS9233**: *The 'file' modifier can be used only on types defined in top level in a compilation unit* + +To create collection expressions with collection builder attributes correctly, follow these requirements. For more information, see [Collection expressions](../operators/collection-expressions.md). + +- Ensure the target type has an iteration type that supports `foreach` (**CS9188**). +- Don't use generic types as collection builder types (**CS9185**). +- Verify the method name specified in `CollectionBuilderAttribute` is valid (**CS9186**). +- Apply `CollectionBuilderAttribute` only with static methods that match the required signature: return the collection type and take a `ReadOnlySpan` parameter where `T` matches the element type (**CS9180**, **CS9181**, **CS9182**, **CS9183**, **CS9187**, **CS9190**). +- Ensure the return type matches and isn't abstract or an interface (**CS9177**, **CS9183**). +- Don't use ref structs or types with ref fields in collection expressions (**CS9218**, **CS9221**, **CS9223**, **CS9228**). +- Avoid using collection expressions in expression trees (**CS9175**). +- Use the correct language version for collection expressions and related features (**CS9196**, **CS9197**, **CS9198**, **CS9199**, **CS9202**). ## Common language specification warnings - **CS3007**: *Overloaded method 'method' differing only by unnamed array types is not CLS-compliant* - **CS3016**: *Arrays as attribute arguments is not CLS-compliant* +To write CLS-compliant code with arrays, follow these guidelines. For more information, see [Language independence](../../../standard/language-independence.md). + +- Don't create overloaded methods that differ only in array element types (**CS3007**). +- Don't use arrays as attribute arguments (**CS3016**). + CS3007 occurs if you have an overloaded method that takes a jagged array and the only difference between the method signatures is the element type of the array. To avoid this error, consider using a rectangular array rather than a jagged array or, if CLS Compliance isn't needed, remove the attribute. For more information on CLS Compliance, see [Language independence and language-independent components](../../../standard/language-independence.md). CS3016 indicates that not compliant with the Common Language Specification (CLS) to pass an array to an attribute. For more information on CLS compliance, see [Language independence and language-independent components](../../../standard/language-independence.md). diff --git a/docs/csharp/language-reference/compiler-messages/extension-declarations.md b/docs/csharp/language-reference/compiler-messages/extension-declarations.md index 6e0b9bb66c72a..3afc8068b58f5 100644 --- a/docs/csharp/language-reference/compiler-messages/extension-declarations.md +++ b/docs/csharp/language-reference/compiler-messages/extension-declarations.md @@ -1,7 +1,8 @@ --- -title: "Errors and warnings related to extension declarations" +title: "Resolve errors and warnings related to extension declarations" description: "These errors and warnings indicate that you need to modify the declaration of an extension method using the `this` modifier on the first parameter, or an extension declaration" -ms.date: 10/16/2025 +ms.date: 11/07/2025 +ai-usage: ai-assisted f1_keywords: - "CS1100" - "CS1101" @@ -44,6 +45,7 @@ f1_keywords: - "CS9323" - "CS9326" - "CS9329" + - "CS9339" helpviewer_keywords: - "CS1100" - "CS1101" @@ -88,9 +90,15 @@ helpviewer_keywords: - "CS9323" - "CS9326" - "CS9329" + - "CS9339" --- -# Errors and warnings related to extension methods declared with `this` parameters or `extension` blocks +# Resolve errors and warnings in extension member declarations +This article covers the following compiler errors: + + - [**CS1100**](#errors-related-to-this-parameter-extension-methods): *Method has a parameter modifier '`this`' which is not on the first parameter* - [**CS1101**](#errors-related-to-this-parameter-extension-methods): *The parameter modifier '`ref`' cannot be used with '`this`'.* - [**CS1102**](#common-errors-on-extension-declarations): *The parameter modifier '`out`' cannot be used with '`this`'.* @@ -134,14 +142,13 @@ helpviewer_keywords: - [**CS9323**](#errors-related-to-extension-block-declarations): *Cannot declare instance extension operator for a type that is not known to be a struct and is not known to be a class.* - [**CS9326**](#errors-related-to-extension-block-declarations): *'`name`': extension member names cannot be the same as their extended type.* - [**CS9329**](#errors-related-to-extension-block-declarations): *This extension block collides with another extension block. They result in conflicting content-based type names in metadata.* +- [**CS9339**](#errors-related-to-extension-block-declarations): *The extension resolution is ambiguous between the following members.* ## Common errors on extension declarations -The compiler emits these errors when you violate rules that apply to all extension member declarations, regardless of the syntax chosen: - - **CS1102**: *The parameter modifier '`out`' cannot be used with '`this`'.* -- **CS1106**: *Extension methods must be defined in a non generic static class.* - **CS1103**: *The first parameter of an extension method cannot be of a pointer type.* +- **CS1106**: *Extension methods must be defined in a non generic static class.* - **CS1109**: *Extension Methods must be defined on top level static classes, 'name' is a nested class.* - **CS1113**: *Extension method defined on a value type cannot be used to create delegates.* - **CS1743**: *Cannot specify a default value for the 'this' parameter.* @@ -149,18 +156,19 @@ The compiler emits these errors when you violate rules that apply to all extensi - **CS9284**: *The receiver parameter of an extension cannot have a default value.* - **CS9285**: *An extension container can have only one receiver parameter.* -Any extension declaration must follow these rules: +The compiler emits these errors when you violate rules that apply to all extension member declarations, regardless of the syntax chosen. For more information, see [Extension methods](../../programming-guide/classes-and-structs/extension-methods.md). -- Its containing type (`class` or `struct`) must be non-generic and `static`. -- Its containing type must be a top-level type. It can't be nested in another type. -- Members that extend an instance of a value type can't be converted to delegates. -- The receiver parameter can't include the `out` parameter modifier. -- The receiver parameter can't have a default argument value. -- Pointer types can't be extended. In other words, the parameter you apply the `this` modifier to can't be a pointer type. +To declare extension members correctly, follow these requirements: -## Errors related to extension block declarations +- Declare the containing type as a non-generic `static` class or struct (**CS1106**, **CS9283**). +- Declare the containing type at the top level, not nested within another type (**CS1109**, **CS9283**). +- Don't convert extension methods on value types to delegates (**CS1113**). Create a regular method instead. +- Don't use the `out` parameter modifier on the receiver parameter (**CS1102**). +- Don't provide default values for the receiver parameter (**CS1743**, **CS9284**). +- Don't extend pointer types (**CS1103**). The parameter you apply the `this` modifier to can't be a pointer type. +- Declare only one receiver parameter per extension container (**CS9285**). -These errors are specific to extension blocks, a C# 14 feature. Extension blocks are declared using the `extension` keyword in a static class. The `extension` declares the type and name of the receiver. All members inside the block declared with `extension` are extension members for that receiver: +## Errors related to extension block declarations - **CS9281**: *Extension declarations may not have a name.* - **CS9282**: *Extension declarations can include only methods or properties.* @@ -191,52 +199,59 @@ These errors are specific to extension blocks, a C# 14 feature. Extension blocks - **CS9323**: *Cannot declare instance extension operator for a type that is not known to be a struct and is not known to be a class.* - **CS9326**: *'`name`': extension member names cannot be the same as their extended type.* - **CS9329**: *This extension block collides with another extension block. They result in conflicting content-based type names in metadata.* +- **CS9339**: *The extension resolution is ambiguous between the following members.* -The contextual keyword [`extension`](../keywords/extension.md) declares an extension block. It can't be used for a type. - -Extension declarations must follow these rules: - -- The extension can't include a name token. The extension declares the receiver only. -- The receiver parameter can't have a default value. +These errors are specific to extension blocks, a C# 14 feature. Extension blocks are declared using the [`extension`](../keywords/extension.md) contextual keyword in a static class. For more information, see [Extension methods](../../programming-guide/classes-and-structs/extension-methods.md). -Extension members declared in an extension block must follow these rules, in addition to the [common rules](#common-errors-on-extension-declarations): +To declare extension blocks correctly, follow these requirements: -- Only methods and properties are valid extension member types. Extension members can extend an instance, or a type. -- The extension must provide a parameter name for the receiver in order to contain members that extend an instance. -- The receiver parameter name must be unique in that extension block. -- All extension members must use all type parameters declared on the extension. They can add more type parameters. -- Extension blocks can't be nested within another extension block. +- Don't include a name token in the extension declaration (**CS9281**). The extension declares the receiver only. +- Don't provide default values for the receiver parameter (**CS9284**, covered in [common errors](#common-errors-on-extension-declarations)). +- Don't use the `extension` keyword for types or aliases (**CS9306**). It's a contextual keyword for extension blocks only. -**CS9316** is emitted when you attempt to use an extension member as an argument to the `nameof` operator. Extension members aren't allowed in this context. +To declare extension members in extension blocks correctly, follow these requirements in addition to the [common rules](#common-errors-on-extension-declarations): -**CS9317**, **CS9318**, **CS9319**, **CS9320**, **CS9321**, **CS9322**, and **CS9323** are operator-related errors in extension blocks: +- Include only methods or properties as extension members (**CS9282**). Other member types aren't supported. +- Provide a parameter name for the receiver to contain instance extension members (**CS9303**). +- Ensure the receiver parameter name is unique within the extension block and doesn't conflict with type parameters (**CS9287**, **CS9288**, **CS9289**, **CS9290**, **CS9291**, **CS9292**, **CS9294**). +- Reference all type parameters declared on the extension in the extended type (**CS9295**). Additional type parameters can be added on individual members. +- Don't nest extension blocks within other extension blocks (**CS9309**). +- Use the `ref` modifier on the receiver parameter only with value types or generic types constrained to struct (**CS9300**). +- Use the `in` or `ref readonly` modifier on the receiver parameter only with concrete (non-generic) value types (**CS9301**). +- Don't use modifiers on unnamed receiver parameters (**CS9305**). +- Don't declare `protected` members in extension blocks (**CS9302**). Extension members must be accessible where the extension is in scope. +- Don't declare `init`-only accessors in extension blocks (**CS9304**). Use regular property setters instead. +- Don't use extension members as arguments to the `nameof` operator (**CS9316**). +- Choose member names that differ from the extended type name (**CS9326**). +- Ensure extension blocks have unique content-based type names in metadata (**CS9329**). Consolidate or differentiate extension blocks to avoid conflicts. +- Resolve ambiguous extension member calls by providing more specific type information or using qualified names (**CS9339**). -- **CS9317**: Unary operators must have the extended type as their parameter. -- **CS9318**: Increment (`++`) and decrement (`--`) operators must have the extended type as their parameter. -- **CS9319**: Binary operators must have at least one parameter that is the extended type. -- **CS9320**: Shift operators must have the extended type as their first operand. -- **CS9321**: You can't declare user-defined operators in extension blocks that extend static classes. -- **CS9322**: When extending a struct with instance operators, the receiver parameter must use the `ref` modifier. -- **CS9323**: You can't declare instance operators for types that aren't constrained to be either a struct or a class. +### Extension block operator requirements -**CS9326** is emitted when an extension member has the same name as the extended type. Choose a different name for the member. +Extension blocks support user-defined operators with specific requirements: -**CS9329** occurs when two extension blocks result in conflicting content-based type names in the compiled metadata. This typically happens when multiple extension blocks with the same receiver type and similar characteristics are declared. Consolidate the extension blocks or differentiate them in a way that produces unique metadata names. +- Unary operators must have the extended type as their parameter (**CS9317**). +- Increment (`++`) and decrement (`--`) operators must have the extended type as their parameter (**CS9318**). +- Binary operators must have at least one parameter that is the extended type (**CS9319**). +- Shift operators must have the extended type as their first operand (**CS9320**). +- Don't declare user-defined operators in extension blocks that extend static classes (**CS9321**). +- When extending a struct with instance operators, use the `ref` modifier on the receiver parameter (**CS9322**). +- Don't declare instance operators for types that aren't constrained to be either a struct or a class (**CS9323**). ## Errors related to `this` parameter extension methods -These errors are specific to extension methods where you declare the receiver by adding the `this` modifier to the first parameter of the method: - - **CS1100**: *Method has a parameter modifier '`this`' which is not on the first parameter* - **CS1101**: *The parameter modifier '`ref`' cannot be used with '`this`'.* - **CS1105**: *Extension methods must be static.* - **CS1110**: *Cannot define a new extension because the compiler required type cannot be found. Are you missing a reference to System.Core.dll?* - **CS1112**: *Do not use ''. Use the '`this`' keyword instead.* -An extension method where the receiver instance includes the `this` modifier must follow these rules, in addition to the [common rules](#common-errors-on-extension-declarations): +These errors are specific to extension methods where you declare the receiver by adding the `this` modifier to the first parameter. For more information, see [Extension methods](../../programming-guide/classes-and-structs/extension-methods.md). + +To declare `this` parameter extension methods correctly, follow these requirements in addition to the [common rules](#common-errors-on-extension-declarations): -- The method must have the `static` modifier. -- The `this` parameter modifier must be applied to the first parameter. It can't be applied to any other parameters on the method. -- The `ref` `out` parameter modifier can't be applied to the first parameter. To apply `ref`, you need to convert to an extension block. -- In .NET Framework apps, `System.Core.dll` must be added as a reference. -- You must specify the `this` modifier on the first parameter. You can't directly use the attribute instead. +- Add the `static` modifier to the method (**CS1105**). +- Apply the `this` parameter modifier only to the first parameter (**CS1100**). +- Don't combine the `ref` modifier with the `this` modifier (**CS1101**). To use `ref`, convert to an extension block. +- Add a reference to `System.Core.dll` in .NET Framework apps (**CS1110**). +- Use the `this` modifier on the first parameter instead of directly applying the attribute (**CS1112**). diff --git a/docs/csharp/language-reference/compiler-messages/feature-version-errors.md b/docs/csharp/language-reference/compiler-messages/feature-version-errors.md index 2f2ace8407605..d3eaae9a09ee4 100644 --- a/docs/csharp/language-reference/compiler-messages/feature-version-errors.md +++ b/docs/csharp/language-reference/compiler-messages/feature-version-errors.md @@ -58,6 +58,8 @@ f1_keywords: - "CS9268" - "CS9269" - "CS9271" + - "CS9327" + - "CS9328" helpviewer_keywords: - "CS0171" - "CS0188" @@ -115,6 +117,8 @@ helpviewer_keywords: - "CS9268" - "CS9269" - "CS9271" + - "CS9327" + - "CS9328" ms.date: 05/23/2025 --- # Resolve warnings related to language features and versions @@ -161,6 +165,8 @@ That's be design. The text closely matches the text of the compiler error / warn - **CS9268**: *Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.* - **CS9269**: *UnscopedRefAttribute is only valid in C# 11 or later or when targeting net7.0 or later.* - [**CS9271**](#implementation-specific-attributes): *The type '`Microsoft.CodeAnalysis.EmbeddedAttribute`' must be non-generic, internal, sealed, non-static, have a parameterless constructor, inherit from System.Attribute, and be able to be applied to any type.* +- **CS9327**: *Feature is not available in C# 14.0. Use newer language version.* +- **CS9328**: *Method uses a feature that is not supported by runtime async currently.* In addition, the following errors and warnings relate to struct initialization changes in recent versions: diff --git a/docs/csharp/language-reference/compiler-messages/overloaded-operator-errors.md b/docs/csharp/language-reference/compiler-messages/overloaded-operator-errors.md index 9458f1b54d92d..555ec6ab4b978 100644 --- a/docs/csharp/language-reference/compiler-messages/overloaded-operator-errors.md +++ b/docs/csharp/language-reference/compiler-messages/overloaded-operator-errors.md @@ -1,6 +1,6 @@ --- -title: Errors and warnings related to user defined operator declarations -description: This article helps you diagnose and correct compiler errors and warnings when you declare user defined operators in your types +title: Resolve errors and warnings related to user-defined operator declarations +description: This article helps you diagnose and correct compiler errors and warnings when you declare user-defined operators in your types f1_keywords: - "CS0056" - "CS0057" @@ -37,6 +37,9 @@ f1_keywords: - "CS9311" - "CS9312" - "CS9313" + - "CS9340" + - "CS9341" + - "CS9342" helpviewer_keywords: - "CS0056" - "CS0057" @@ -73,12 +76,15 @@ helpviewer_keywords: - "CS9311" - "CS9312" - "CS9313" -ms.date: 10/15/2025 + - "CS9340" + - "CS9341" + - "CS9342" +ms.date: 11/07/2025 ai-usage: ai-assisted --- -# Errors and warnings for overloaded, or user-defined operator declarations +# Resolve errors and warnings in user-defined operator declarations -There are several errors related to declaring overloaded operators. Overloaded operators are also referred to as user-defined operators +This article covers the following compiler errors: +- [**CS8509**](#incomplete-pattern-matching): *The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '...' is not covered.* +- [**CS9134**](#switch-expression-syntax-errors): *A switch expression arm does not begin with a 'case' keyword.* +- [**CS9135**](#switch-expression-syntax-errors): *A constant value of type is expected* +- [**CS9335, CS9336**](#redundant-patterns): *The pattern is redundant.* +- [**CS9337**](#redundant-patterns): *The pattern is too complex to analyze for redundancy.* + +## Switch expression syntax errors - **CS9134**: *A switch expression arm does not begin with a 'case' keyword.* - **CS9135**: *A constant value of type is expected* -- **CS9335**: *The pattern is redundant.* -- **CS9337**: *The pattern is too complex to analyze for redundancy.* -The compiler generates the following warnings for incomplete pattern matching expressions: +To write switch expressions correctly, follow the proper syntax rules. For more information, see [Switch expression](../operators/switch-expression.md). -- **CS8509**: *The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '...' is not covered.* +- Don't use the `case` keyword in switch expressions (**CS9134**). The `case` keyword is used in switch statements, not switch expressions. In a switch expression, each arm consists of a pattern, an optional case guard, the `=>` token, and an expression. +- Use constant values in patterns, not variables (**CS9135**). Pattern matching requires compile-time constants for value patterns. -The compiler generates CS9134 to help you convert a switch statement to a switch expression. The `case` keyword isn't used in a switch expression. If you have the `case` keyword in a switch expression, it must be removed: +The following example demonstrates the syntax error with `case`: ```csharp var answer = x switch @@ -38,24 +51,46 @@ var answer = x switch } ``` -The compiler generates CS9135 when the pattern isn't a constant value. You can't create pattern matching expressions to match against a variable. +To fix this error, remove the `case` keyword: + +```csharp +var answer = x switch +{ + 0 => false, + 1 => true, +} +``` + +## Incomplete pattern matching + +- **CS8509**: *The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '...' is not covered.* + +To create exhaustive switch expressions, cover all possible input values. For more information, see [Switch expression](../operators/switch-expression.md) and [Switch statement](../statements/selection-statements.md#the-switch-statement). + +Add switch arms that handle all possible input values. Use the discard pattern (`_`) to match any remaining values that you don't need to handle explicitly. -The following code snippets generate CS8509: +The following example generates CS8509: :::code language="csharp" source="./snippets/pattern-matching-warnings/Switch.cs" id="SwitchNotAllPossibleValues"::: -To address this warning, add switch arms that cover all possible input values. For example: +To fix this warning, add a default arm: :::code language="csharp" source="./snippets/pattern-matching-warnings/Switch.cs" id="SwitchAllPossibleValues"::: -The `_` pattern matches all remaining values. One scenario for the `_` pattern is matching invalid values, as shown in the preceding example. +The `_` pattern matches all remaining values. You can use this pattern to handle invalid or unexpected values. -The compiler generates CS9335 when you wrote a pattern where an `or` is redundant: +## Redundant patterns -:::code language="csharp" source="./snippets/pattern-matching-warnings/Switch.cs" id="RedundantPattern"::: +- **CS9335, CS9336**: *The pattern is redundant.* +- **CS9337**: *The pattern is too complex to analyze for redundancy.* + +To write clear pattern matching expressions, avoid redundant patterns. For more information, see [Patterns](../operators/patterns.md). -This warning indicates you likely meant `is not (null or 42)` or `is not (int or string)` instead. +- Review patterns that the compiler identifies as redundant (**CS9335**, **CS9336**). Redundant patterns can indicate a logic error where you meant to use `not` or different logical operators. +- Simplify complex patterns that are too difficult for the compiler to analyze (**CS9337**). Break down complex patterns into simpler, more maintainable expressions. -You can construct patterns that are too complex to analyze for redundancy. If you do that, the compiler warns you with CS9337. +The following example demonstrates a redundant pattern: + +:::code language="csharp" source="./snippets/pattern-matching-warnings/Switch.cs" id="RedundantPattern"::: -For more information, see [Switch](../statements/selection-statements.md#the-switch-statement). +This warning indicates you likely meant `is not (null or 42)` or `is not (int or string)` instead of using `or` at the top level. diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml index 94decd6cadc06..ccba45bd2a50e 100644 --- a/docs/csharp/language-reference/toc.yml +++ b/docs/csharp/language-reference/toc.yml @@ -474,7 +474,7 @@ items: 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, CS9260, CS9268, CS9269, CS9271 + CS9240, CS9260, CS9268, CS9269, CS9271, CS9327, CS9328 - name: Assembly references href: ./compiler-messages/assembly-references.md displayName: > @@ -496,7 +496,7 @@ items: CS0056, CS0057, CS0215, CS0216, CS0217, CS0218, CS0448, CS0552, CS0553, CS0554, CS0555, CS0556, CS0557, CS0558, CS0559, CS0562, CS0563, CS0564, CS0567, CS0590, CS0660, CS0661, CS0715, CS1037, CS1553, CS1554, CS8930, CS8931, CS9023, CS9024, - CS9025, CS9308, CS9310, CS9311, CS9312, CS9313 + CS9025, CS9308, CS9310, CS9311, CS9312, CS9313, CS9340, CS9341, CS9342 - name: Parameter / argument mismatch href: ./compiler-messages/parameter-argument-mismatch.md displayName: > @@ -533,7 +533,7 @@ items: CS1743, CS9281, CS9282, CS9283, CS9284, CS9285, CS9287, CS9288, CS9289, CS9290, CS9292, CS9293, CS9295, CS9300, CS9301, CS9302, CS9303, CS9304, CS9305, CS9306, CS9309, CS9316, CS9317, CS9318, CS9319, CS9320, CS9321, CS9322, CS9323, CS9326, - CS9329 + CS9329, CS9339 - name: Partial declarations href: ./compiler-messages/partial-declarations.md displayName: > @@ -560,7 +560,7 @@ items: CS8770, CS8774, CS8776, CS8775, CS8777, CS8819, CS8824, CS8825, CS8847 - name: Pattern matching warnings href: ./compiler-messages/pattern-matching-warnings.md - displayName: CS8509, CS9134, CS9135, CS9335, CS9337 + displayName: CS8509, CS9134, CS9135, CS9335, CS9336, CS9337 - name: String literal declarations href: ./compiler-messages/string-literal.md displayName: > @@ -573,7 +573,8 @@ items: CS0022, CS0178, CS0248, CS0251, CS0270, CS0611, CS0623, CS0650, CS0719, CS0747, CS0820, CS0826, CS0846, CS1062, CS1063, CS1064, CS1552, CS1586, CS1920, CS1921, CS1925, CS1950, CS1954, CS3007, CS3016, CS9174, CS9176, CS9185, CS9186, CS9187, - CS9188, CS9203, CS9208, CS9209, CS9210, CS9212, CS9213, CS9214, CS9215, CS9222 + CS9188, CS9203, CS9208, CS9209, CS9210, CS9212, CS9213, CS9214, CS9215, CS9222, + CS9332 - name: Inline arrays href: ./compiler-messages/inline-array-errors.md displayName: > diff --git a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md index e33a9a15c0a6d..9fe1611f0a880 100644 --- a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md +++ b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md @@ -548,11 +548,8 @@ f1_keywords: - "CS9096" - "CS9097" # C# 14 errors begin here - - "CS9327" - - "CS9328" - "CS9330" - "CS9331" - - "CS9332" - "CS9333" - "CS9334" - "CS9338" From ffda38411996fbd4ce28d6e6296ae7cd6c2e3369 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 7 Nov 2025 12:10:27 -0800 Subject: [PATCH 21/38] Update System.Text.Json converter source links to main branch (#49670) --- .../system-text-json/converters-how-to.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/standard/serialization/system-text-json/converters-how-to.md b/docs/standard/serialization/system-text-json/converters-how-to.md index 05ebc619964d8..bc246901b9903 100644 --- a/docs/standard/serialization/system-text-json/converters-how-to.md +++ b/docs/standard/serialization/system-text-json/converters-how-to.md @@ -70,7 +70,7 @@ The following steps explain how to create a converter by following the basic pat * Override the `Write` method to serialize the incoming object of type `T`. Use the that is passed to the method to write the JSON. * Override the `CanConvert` method only if necessary. The default implementation returns `true` when the type to convert is of type `T`. Therefore, converters that support only type `T` don't need to override this method. For an example of a converter that does need to override this method, see the [polymorphic deserialization](#support-polymorphic-deserialization) section later in this article. -You can refer to the [built-in converters source code](https://github.com/dotnet/runtime/tree/81bf79fd9aa75305e55abe2f7e9ef3f60624a3a1/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/) as reference implementations for writing custom converters. +You can refer to the [built-in converters source code](https://github.com/dotnet/runtime/tree/main/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/) as reference implementations for writing custom converters. ## Steps to follow the factory pattern @@ -228,7 +228,7 @@ For scenarios that require type inference, the following code shows a custom con The example shows the converter code and a `WeatherForecast` class with `object` properties. The `Main` method deserializes a JSON string into a `WeatherForecast` instance, first without using the converter, and then using the converter. The console output shows that without the converter, the run-time type for the `Date` property is `JsonElement`; with the converter, the run-time type is `DateTime`. -The [unit tests folder](https://github.com/dotnet/runtime/tree/c72b54243ade2e1118ab24476220a2eba6057466/src/libraries/System.Text.Json/tests/Serialization/) in the `System.Text.Json.Serialization` namespace has more examples of custom converters that handle deserialization to `object` properties. +The [unit tests folder](https://github.com/dotnet/runtime/tree/main/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests) in the `System.Text.Json.Serialization` namespace has more examples of custom converters that handle deserialization to `object` properties. ### Support polymorphic deserialization @@ -364,18 +364,18 @@ When you use , The [Migrate from Newtonsoft.Json to System.Text.Json](migrate-from-newtonsoft.md) article contains additional samples of custom converters. -The [unit tests folder](https://github.com/dotnet/runtime/blob/81bf79fd9aa75305e55abe2f7e9ef3f60624a3a1/src/libraries/System.Text.Json/tests/Serialization/) in the `System.Text.Json.Serialization` source code includes other custom converter samples, such as: +The [unit tests folder](https://github.com/dotnet/runtime/tree/main/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests) in the `System.Text.Json.Serialization` source code includes other custom converter samples, such as: -* [Int32 converter that converts null to 0 on deserialize](https://github.com/dotnet/runtime/blob/81bf79fd9aa75305e55abe2f7e9ef3f60624a3a1/src/libraries/System.Text.Json/tests/Serialization/CustomConverterTests.NullValueType.cs) -* [Int32 converter that allows both string and number values on deserialize](https://github.com/dotnet/runtime/blob/81bf79fd9aa75305e55abe2f7e9ef3f60624a3a1/src/libraries/System.Text.Json/tests/Serialization/CustomConverterTests.Int32.cs) -* [Enum converter](https://github.com/dotnet/runtime/blob/81bf79fd9aa75305e55abe2f7e9ef3f60624a3a1/src/libraries/System.Text.Json/tests/Serialization/CustomConverterTests.Enum.cs) -* [List\ converter that accepts external data](https://github.com/dotnet/runtime/blob/81bf79fd9aa75305e55abe2f7e9ef3f60624a3a1/src/libraries/System.Text.Json/tests/Serialization/CustomConverterTests.List.cs) -* [Long[] converter that works with a comma-delimited list of numbers](https://github.com/dotnet/runtime/blob/81bf79fd9aa75305e55abe2f7e9ef3f60624a3a1/src/libraries/System.Text.Json/tests/Serialization/CustomConverterTests.Array.cs) +* [Int32 converter that converts null to 0 on deserialize](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests/CustomConverterTests.NullValueType.cs) +* [Int32 converter that allows both string and number values on deserialize](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests/CustomConverterTests.Int32.cs) +* [Enum converter](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests/CustomConverterTests.Enum.cs) +* [List\ converter that accepts external data](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests/CustomConverterTests.List.cs) +* [Long[] converter that works with a comma-delimited list of numbers](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests/CustomConverterTests.Array.cs) -If you need to make a converter that modifies the behavior of an existing built-in converter, you can get [the source code of the existing converter](https://github.com/dotnet/runtime/tree/81bf79fd9aa75305e55abe2f7e9ef3f60624a3a1/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters) to serve as a starting point for customization. +If you need to make a converter that modifies the behavior of an existing built-in converter, you can get [the source code of the existing converter](https://github.com/dotnet/runtime/tree/main/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters) to serve as a starting point for customization. ## Additional resources -* [Source code for built-in converters](https://github.com/dotnet/runtime/tree/81bf79fd9aa75305e55abe2f7e9ef3f60624a3a1/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters) +* [Source code for built-in converters](https://github.com/dotnet/runtime/tree/main/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters) * [System.Text.Json overview](overview.md) * [How to serialize and deserialize JSON](how-to.md) From 450e9e3094b1722bf63a5ddd2070e891020facc7 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 7 Nov 2025 13:49:05 -0800 Subject: [PATCH 22/38] Update package index with latest published versions (#49673) --- docs/azure/includes/dotnet-all.md | 1 + docs/azure/includes/dotnet-new.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 05ba167f03daa..89e6780e1929c 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -149,6 +149,7 @@ | Provisioning - Container Service | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.Provisioning.ContainerService/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Provisioning.ContainerService-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ContainerService_1.0.0-beta.4/sdk/provisioning/Azure.Provisioning.ContainerService/) | | Provisioning - CosmosDB | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Provisioning.CosmosDB/1.0.0)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.CosmosDB/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.CosmosDB-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CosmosDB_1.0.0/sdk/provisioning/Azure.Provisioning.CosmosDB/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CosmosDB_1.1.0-beta.1/sdk/provisioning/Azure.Provisioning.CosmosDB/) | | Provisioning - Deployment | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.Deployment/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.Deployment-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Deployment_1.0.0-beta.2/sdk/provisioning/Azure.Provisioning.Deployment/) | +| Provisioning - Dns | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Dns/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Dns-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Dns_1.0.0-beta.1/sdk/provisioning/Azure.Provisioning.Dns/) | | Provisioning - Event Grid | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.EventGrid/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.EventGrid-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.EventGrid_1.1.0/sdk/provisioning/Azure.Provisioning.EventGrid/) | | Provisioning - Event Hubs | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.EventHubs/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.EventHubs-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.EventHubs_1.1.0/sdk/provisioning/Azure.Provisioning.EventHubs/) | | Provisioning - Frontdoor | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.FrontDoor/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.FrontDoor-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.FrontDoor_1.0.0-beta.1/sdk/provisioning/Azure.Provisioning.FrontDoor/) | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 0160aff9f81cb..c130caa58020d 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -158,6 +158,7 @@ | Provisioning - Container Service | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.Provisioning.ContainerService/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Provisioning.ContainerService-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ContainerService_1.0.0-beta.4/sdk/provisioning/Azure.Provisioning.ContainerService/) | | Provisioning - CosmosDB | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Provisioning.CosmosDB/1.0.0)
NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.CosmosDB/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.CosmosDB-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CosmosDB_1.0.0/sdk/provisioning/Azure.Provisioning.CosmosDB/)
GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CosmosDB_1.1.0-beta.1/sdk/provisioning/Azure.Provisioning.CosmosDB/) | | Provisioning - Deployment | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.Deployment/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.Deployment-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Deployment_1.0.0-beta.2/sdk/provisioning/Azure.Provisioning.Deployment/) | +| Provisioning - Dns | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Dns/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Dns-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Dns_1.0.0-beta.1/sdk/provisioning/Azure.Provisioning.Dns/) | | Provisioning - Event Grid | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.EventGrid/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.EventGrid-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.EventGrid_1.1.0/sdk/provisioning/Azure.Provisioning.EventGrid/) | | Provisioning - Event Hubs | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.EventHubs/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.EventHubs-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.EventHubs_1.1.0/sdk/provisioning/Azure.Provisioning.EventHubs/) | | Provisioning - Frontdoor | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.FrontDoor/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.FrontDoor-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.FrontDoor_1.0.0-beta.1/sdk/provisioning/Azure.Provisioning.FrontDoor/) | From 3ee81bf81346e5abb9e45e477d11a08587ea43cc Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Fri, 7 Nov 2025 16:50:05 -0500 Subject: [PATCH 23/38] Replace UWP with WinUI (#49672) The Windows docs team wants to emphasize WinUI over UWP --- docs/index.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.yml b/docs/index.yml index 8a30b9bde4abf..18ab3c0dfa31b 100644 --- a/docs/index.yml +++ b/docs/index.yml @@ -271,8 +271,8 @@ additionalContent: # Card - title: Desktop links: - - url: /uwp - text: Universal Windows apps + - url: /windows/apps/winui + text: WinUI apps - url: /dotnet/desktop/wpf/ text: Windows Presentation Foundation - url: /dotnet/desktop/winforms/ From 0803ef32b162802c82e377ac069cc9a024624c2d Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Fri, 7 Nov 2025 23:31:27 +0100 Subject: [PATCH 24/38] Fix note syntax for mstest analyzer docs (#49679) * Fix note syntax for mstest analyzer docs * Update mstest0034.md * Update mstest0053.md --- docs/core/testing/mstest-analyzers/mstest0034.md | 2 +- docs/core/testing/mstest-analyzers/mstest0039.md | 2 +- docs/core/testing/mstest-analyzers/mstest0053.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/core/testing/mstest-analyzers/mstest0034.md b/docs/core/testing/mstest-analyzers/mstest0034.md index f07e10d31fa3e..b13805dc2d593 100644 --- a/docs/core/testing/mstest-analyzers/mstest0034.md +++ b/docs/core/testing/mstest-analyzers/mstest0034.md @@ -24,7 +24,7 @@ ms.author: enjieid | **Introduced in version** | 3.6.0 | | **Is there a code fix** | No | -> [NOTE] +> [!NOTE] > This analyzer is no longer relevant for MSTest 4 as `ClassCleanupBehavior` was removed. ## Cause diff --git a/docs/core/testing/mstest-analyzers/mstest0039.md b/docs/core/testing/mstest-analyzers/mstest0039.md index bbe3078613846..7e9bfde4b087d 100644 --- a/docs/core/testing/mstest-analyzers/mstest0039.md +++ b/docs/core/testing/mstest-analyzers/mstest0039.md @@ -24,7 +24,7 @@ ms.author: ygerges | **Introduced in version** | 3.8.0 | | **Is there a code fix** | Yes | -> [NOTE] +> [!NOTE] > This analyzer is no longer relevant for MSTest 4 as the old assertion APIs were removed. ## Cause diff --git a/docs/core/testing/mstest-analyzers/mstest0053.md b/docs/core/testing/mstest-analyzers/mstest0053.md index eac408e4daa2d..8e5df69d3dbeb 100644 --- a/docs/core/testing/mstest-analyzers/mstest0053.md +++ b/docs/core/testing/mstest-analyzers/mstest0053.md @@ -25,7 +25,7 @@ ai-usage: ai-generated | **Introduced in version** | 3.11.0 | | **Is there a code fix** | Yes | -> [NOTE] +> [!NOTE] > This analyzer is no longer relevant for MSTest 4 as the assertion APIs with format parameters were removed. ## Cause From 9d4685bd4349b3838b31514ff30721ada4bdaada Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 7 Nov 2025 15:22:13 -0800 Subject: [PATCH 25/38] Add LSG diagnostic articles (#49678) --- .openpublishing.redirection.fundamentals.json | 16 --------- .../source-generator-overview.md | 14 +++++--- .../syslib-diagnostics/syslib1024.md | 17 ++++++++++ .../syslib-diagnostics/syslib1025.md | 17 ++++++++++ .../syslib-diagnostics/syslib1026.md | 17 ++++++++++ .../syslib-diagnostics/syslib1027.md | 33 +++++++++++++++++++ .../syslib-diagnostics/syslib1220-1229.md | 4 +-- docs/navigate/tools-diagnostics/toc.yml | 8 +++++ 8 files changed, 103 insertions(+), 23 deletions(-) create mode 100644 docs/fundamentals/syslib-diagnostics/syslib1024.md create mode 100644 docs/fundamentals/syslib-diagnostics/syslib1025.md create mode 100644 docs/fundamentals/syslib-diagnostics/syslib1026.md create mode 100644 docs/fundamentals/syslib-diagnostics/syslib1027.md diff --git a/.openpublishing.redirection.fundamentals.json b/.openpublishing.redirection.fundamentals.json index e5421abd3fa23..913887e237ead 100644 --- a/.openpublishing.redirection.fundamentals.json +++ b/.openpublishing.redirection.fundamentals.json @@ -249,22 +249,6 @@ "source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1004.md", "redirect_url": "/dotnet/fundamentals/syslib-diagnostics/source-generator-overview" }, - { - "source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1024.md", - "redirect_url": "/dotnet/fundamentals/syslib-diagnostics/source-generator-overview" - }, - { - "source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1025.md", - "redirect_url": "/dotnet/fundamentals/syslib-diagnostics/source-generator-overview" - }, - { - "source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1026.md", - "redirect_url": "/dotnet/fundamentals/syslib-diagnostics/source-generator-overview" - }, - { - "source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1027.md", - "redirect_url": "/dotnet/fundamentals/syslib-diagnostics/source-generator-overview" - }, { "source_path_from_root": "/docs/fundamentals/syslib-diagnostics/syslib1028.md", "redirect_url": "/dotnet/fundamentals/syslib-diagnostics/source-generator-overview" diff --git a/docs/fundamentals/syslib-diagnostics/source-generator-overview.md b/docs/fundamentals/syslib-diagnostics/source-generator-overview.md index 2b34cfaf71162..18794f73ea496 100644 --- a/docs/fundamentals/syslib-diagnostics/source-generator-overview.md +++ b/docs/fundamentals/syslib-diagnostics/source-generator-overview.md @@ -1,7 +1,7 @@ --- title: Analyzer diagnostics in .NET 6+ description: Learn about analyzer diagnostics created by source generators in .NET 6 and later versions that produce SYSLIB compiler warnings. -ms.date: 10/27/2023 +ms.date: 11/07/2025 --- # Source-generator diagnostics in .NET 6+ @@ -43,10 +43,10 @@ The following table provides an index to the `SYSLIB1XXX` diagnostics in .NET 6 | [SYSLIB1021][1021] | Multiple message-template item names differ only by case | | [SYSLIB1022][1022] | Can't have malformed format strings (for example, dangling curly braces) | | [SYSLIB1023][1023] | Generating more than six arguments is not supported | -| SYSLIB1024 | Logging method argument uses unsupported `out` parameter modifier | -| SYSLIB1025 | Multiple logging methods cannot use the same event name within a class | -| SYSLIB1026 | C# language version not supported by the logging source generator. | -| SYSLIB1027 | Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field | +| [SYSLIB1024][1024] | Logging method argument uses unsupported `out` parameter modifier | +| [SYSLIB1025][1025] | Multiple logging methods cannot use the same event name within a class | +| [SYSLIB1026][1026] | C# language version not supported by the logging source generator. | +| [SYSLIB1027][1027] | Primary constructor parameter of type `Microsoft.Extensions.Logging.ILogger` is hidden by a field | | SYSLIB1028 | (Reserved for logging.) | | SYSLIB1029 | (Reserved for logging.) | | [SYSLIB1030][1030] | The `System.Text.Json` source generator did not generate serialization metadata for type | @@ -194,6 +194,10 @@ The following table provides an index to the `SYSLIB1XXX` diagnostics in .NET 6 [1021]: syslib1021.md [1022]: syslib1022.md [1023]: syslib1023.md +[1024]: syslib1024.md +[1025]: syslib1025.md +[1026]: syslib1026.md +[1027]: syslib1027.md [1030]: syslib1030.md [1031]: syslib1031.md [1032]: syslib1032.md diff --git a/docs/fundamentals/syslib-diagnostics/syslib1024.md b/docs/fundamentals/syslib-diagnostics/syslib1024.md new file mode 100644 index 0000000000000..bc6e68e003882 --- /dev/null +++ b/docs/fundamentals/syslib-diagnostics/syslib1024.md @@ -0,0 +1,17 @@ +--- +title: SYSLIB1024 error +description: Learn about the diagnostic that generates compile-time error SYSLIB1024. +ms.date: 11/07/2025 +f1_keywords: + - SYSLIB1024 +--- + +# SYSLIB1024: Argument is using the unsupported 'out' parameter modifier + +The `out` parameter modifier isn't supported for -annotated logging methods. + +## Workarounds + +Remove the `out` parameter modifier. + +[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] diff --git a/docs/fundamentals/syslib-diagnostics/syslib1025.md b/docs/fundamentals/syslib-diagnostics/syslib1025.md new file mode 100644 index 0000000000000..985bf09b8efb0 --- /dev/null +++ b/docs/fundamentals/syslib-diagnostics/syslib1025.md @@ -0,0 +1,17 @@ +--- +title: SYSLIB1025 error +description: Learn about the diagnostic that generates compile-time error SYSLIB1025. +ms.date: 11/07/2025 +f1_keywords: + - SYSLIB1025 +--- + +# SYSLIB1025: Multiple logging methods should not use the same event name within a class + +Within the scope of a class, log methods annotated with must use unique event names. + +## Workarounds + +Use a unique event name. + +[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] diff --git a/docs/fundamentals/syslib-diagnostics/syslib1026.md b/docs/fundamentals/syslib-diagnostics/syslib1026.md new file mode 100644 index 0000000000000..b29d6a508901d --- /dev/null +++ b/docs/fundamentals/syslib-diagnostics/syslib1026.md @@ -0,0 +1,17 @@ +--- +title: SYSLIB1026 error +description: Learn about the diagnostic that generates compile-time error SYSLIB1026. +ms.date: 11/07/2025 +f1_keywords: + - SYSLIB1026 +--- + +# SYSLIB1026: C# language version not supported by the source generator + +The logging source generator generates code using the [nullable](../../csharp/nullable-references.md) feature, which is only supported starting in C# 8. + +## Workarounds + +Set your C# language version to 8 or later. + +[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] diff --git a/docs/fundamentals/syslib-diagnostics/syslib1027.md b/docs/fundamentals/syslib-diagnostics/syslib1027.md new file mode 100644 index 0000000000000..bc9b616382676 --- /dev/null +++ b/docs/fundamentals/syslib-diagnostics/syslib1027.md @@ -0,0 +1,33 @@ +--- +title: SYSLIB1027 error +description: Learn about the diagnostic that generates compile-time error SYSLIB1027. +ms.date: 11/07/2025 +f1_keywords: + - SYSLIB1027 +--- + +# SYSLIB1027: Primary constructor parameter of type 'Microsoft.Extensions.Logging.ILogger' is hidden by a field + +A class has a primary constructor parameter of type that's hidden by a field in the class or a base class, which prevents its use. + +For example, the following class raises the `SYSLIB1027` diagnostic: + +```csharp +partial class C(ILogger logger) +{ + private readonly object logger = logger; + + [LoggerMessage(EventId = 0, Level = LogLevel.Debug, Message = "...")] + public partial void M1(); +} +``` + +## Workarounds + +Either remove the field or the primary constructor. For more information, see [Basic usage](../../core/extensions/logger-message-generator.md#basic-usage). + +[!INCLUDE [suppress-syslib-warning](includes/suppress-source-generator-diagnostics.md)] + +## See also + +- [Compile-time logging source generation](../../core/extensions/logger-message-generator.md) diff --git a/docs/fundamentals/syslib-diagnostics/syslib1220-1229.md b/docs/fundamentals/syslib-diagnostics/syslib1220-1229.md index 92576f7013c04..aeb2af99514bf 100644 --- a/docs/fundamentals/syslib-diagnostics/syslib1220-1229.md +++ b/docs/fundamentals/syslib-diagnostics/syslib1220-1229.md @@ -1,7 +1,7 @@ --- title: SYSLIB diagnostics for System.Text.Json.SourceGeneration description: Learn about the System.Text.Json source-generation analyzers that generate compile-time suggestions SYSLIB1220 through SYSLIB1229. -ms.date: 10/24/2023 +ms.date: 11/07/2025 f1_keywords: - syslib1220 - syslib1221 @@ -25,7 +25,7 @@ The following table shows the diagnostic IDs for System.Text.Json source-generat | `SYSLIB1222` | Constructor annotated with `JsonConstructorAttribute` is inaccessible. | | `SYSLIB1223` | Attributes deriving from `JsonConverterAttribute` are not supported by the source generator. | | `SYSLIB1224` | Types annotated with `JsonSerializableAttribute` must be classes deriving from `JsonSerializerContext`. | -| `SYSLIB1225` | Reserved for System.Text.Json.SourceGeneration. | +| `SYSLIB1225` | Type includes `ref` like property, field, or constructor parameter. | | `SYSLIB1226` | Reserved for System.Text.Json.SourceGeneration. | | `SYSLIB1227` | Reserved for System.Text.Json.SourceGeneration. | | `SYSLIB1228` | Reserved for System.Text.Json.SourceGeneration. | diff --git a/docs/navigate/tools-diagnostics/toc.yml b/docs/navigate/tools-diagnostics/toc.yml index c504a4d148d37..3bfea72f9aa3b 100644 --- a/docs/navigate/tools-diagnostics/toc.yml +++ b/docs/navigate/tools-diagnostics/toc.yml @@ -4112,6 +4112,14 @@ items: href: ../../fundamentals/syslib-diagnostics/syslib1022.md - name: SYSLIB1023 href: ../../fundamentals/syslib-diagnostics/syslib1023.md + - name: SYSLIB1024 + href: ../../fundamentals/syslib-diagnostics/syslib1024.md + - name: SYSLIB1025 + href: ../../fundamentals/syslib-diagnostics/syslib1025.md + - name: SYSLIB1026 + href: ../../fundamentals/syslib-diagnostics/syslib1026.md + - name: SYSLIB1027 + href: ../../fundamentals/syslib-diagnostics/syslib1027.md - name: SYSLIB1030 href: ../../fundamentals/syslib-diagnostics/syslib1030.md - name: SYSLIB1031 From 190e78f356350e0bb53b803b2c966ab2a89ec9ac Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Sat, 8 Nov 2025 00:50:41 +0000 Subject: [PATCH 26/38] Add workaround for RID-specific tool publishing (#49295) --- .../compatibility/sdk/10.0/dotnet-tool-pack-publish.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/core/compatibility/sdk/10.0/dotnet-tool-pack-publish.md b/docs/core/compatibility/sdk/10.0/dotnet-tool-pack-publish.md index 6db7eca562eca..0f4d0080f841c 100644 --- a/docs/core/compatibility/sdk/10.0/dotnet-tool-pack-publish.md +++ b/docs/core/compatibility/sdk/10.0/dotnet-tool-pack-publish.md @@ -39,6 +39,15 @@ This change enables the creation of optimized, platform-specific .NET Tool packa If you want to create tools for only a subset of platforms, use `ToolPackageRuntimeIdentifiers`. If you want to disable RID-specific tool packages entirely, you should conditionally include or exclude the `RuntimeIdentifiers` property in your project file. +Alternatively, if you want to maintain the previous behavior (framework-dependent, platform-agnostic .NET Tools) even when a `RuntimeIdentifier` is specified, add the following properties to your project file: + +```xml + + false + false + +``` + ## Affected APIs None. From fdea82fcfe24ca49eb8c7cbeb82f705c42142292 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Mon, 10 Nov 2025 07:39:49 -0800 Subject: [PATCH 27/38] Update APIs that always throw on .NET (#49682) --- .../cryptography/10.0/openssl-macos-unsupported.md | 4 ++-- docs/core/compatibility/unsupported-apis.md | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/core/compatibility/cryptography/10.0/openssl-macos-unsupported.md b/docs/core/compatibility/cryptography/10.0/openssl-macos-unsupported.md index e40080bb5947e..fc223ec6c668d 100644 --- a/docs/core/compatibility/cryptography/10.0/openssl-macos-unsupported.md +++ b/docs/core/compatibility/cryptography/10.0/openssl-macos-unsupported.md @@ -1,11 +1,11 @@ --- -title: "Breaking change: OpenSSL cryptographic primitives aren't supported on macOS" +title: "Breaking change: OpenSSL cryptographic primitives not supported on macOS" description: "Learn about the breaking change in .NET 10 where OpenSSL cryptographic primitives are no longer supported on macOS." ms.date: 06/23/2025 ai-usage: ai-assisted ms.custom: https://github.com/dotnet/docs/issues/46789 --- -# OpenSSL cryptographic primitives are not supported on macOS +# OpenSSL cryptographic primitives not supported on macOS Starting in .NET 10, OpenSSL-backed cryptographic primitives are no longer supported on macOS. and classes that are specific to OpenSSL, such as , now throw a on macOS. diff --git a/docs/core/compatibility/unsupported-apis.md b/docs/core/compatibility/unsupported-apis.md index 36b703f05db71..864b69782a092 100644 --- a/docs/core/compatibility/unsupported-apis.md +++ b/docs/core/compatibility/unsupported-apis.md @@ -2,11 +2,11 @@ title: Unsupported APIs on .NET Core and .NET 5+ titleSuffix: "" description: Learn which .NET APIs always throw an exception on .NET Core and .NET 5 and later versions. -ms.date: 09/08/2025 +ms.date: 11/07/2025 --- -# APIs that always throw exceptions on .NET Core and .NET 5+ +# APIs that always throw exceptions on .NET (Core) -The following APIs will always throw an exception on .NET (Core) on all or a subset of platforms. In most cases, the exception that's thrown is . +The following APIs always throw an exception on .NET (Core) on all or a subset of platforms. In most cases, the exception that's thrown is . This article organizes the affected APIs by namespace. @@ -242,6 +242,7 @@ This article organizes the affected APIs by namespace. | Member | Platforms that throw | |--------|----------------------| +| | macOS | | | All | | | Linux and macOS | | | Linux and macOS | @@ -264,14 +265,17 @@ This article organizes the affected APIs by namespace. | | Linux and macOS | | | Linux and macOS | | | Linux and macOS | +| | macOS | | | All | | | All | | | All | | | All | +| | macOS | | | Linux and macOS | | | All | | | All | | | All | +| | macOS | | | All | | | All | | | All | @@ -284,10 +288,12 @@ This article organizes the affected APIs by namespace. | | Linux and macOS | | | All | | | All | +| | macOS | | | All | | | All | | | All | | | All | +| | macOS | | | All | | | All | From 54464add445230cd200376d260bffa559bd7e568 Mon Sep 17 00:00:00 2001 From: Adam Boniecki <20281641+abonie@users.noreply.github.com> Date: Mon, 10 Nov 2025 17:03:36 +0100 Subject: [PATCH 28/38] What's new in F# 10 (#49649) * What's new in F# 10 * Add ai-usage metadata * Add link in .net 10 overview to F# * Apply suggestions from code review Co-authored-by: Adam Boniecki <20281641+abonie@users.noreply.github.com> * Add links to language reference * Add entries about *Final methods to CE reference * Update parameters page with voption for optional param info * Apply review feedback * Add type cache section * Add Whats New F#10 to the ToC --------- Co-authored-by: Bill Wagner --- docs/core/whats-new/dotnet-10/overview.md | 2 +- docs/fsharp/index.yml | 2 + .../computation-expressions.md | 2 + .../parameters-and-arguments.md | 12 + docs/fsharp/toc.yml | 2 + docs/fsharp/whats-new/fsharp-10.md | 401 ++++++++++++++++++ 6 files changed, 420 insertions(+), 1 deletion(-) create mode 100644 docs/fsharp/whats-new/fsharp-10.md diff --git a/docs/core/whats-new/dotnet-10/overview.md b/docs/core/whats-new/dotnet-10/overview.md index 1ffca77d92077..bbb8b42c6e51e 100644 --- a/docs/core/whats-new/dotnet-10/overview.md +++ b/docs/core/whats-new/dotnet-10/overview.md @@ -75,7 +75,7 @@ The F# updates in .NET 10 include several new features and improvements across t General improvements and bug fixes in the compiler implementation. -For more information, see the [F# release notes](https://fsharp.github.io/fsharp-compiler-docs/release-notes/About.html). +For more information, see [What's new in F# 10](../../../fsharp/whats-new/fsharp-10.md) or the [F# release notes](https://fsharp.github.io/fsharp-compiler-docs/release-notes/About.html). ## Visual Basic diff --git a/docs/fsharp/index.yml b/docs/fsharp/index.yml index 8480d506db697..2219fb6212cdc 100644 --- a/docs/fsharp/index.yml +++ b/docs/fsharp/index.yml @@ -120,6 +120,8 @@ landingContent: linkLists: - linkListType: whats-new links: + - text: "What's new in F# 10" + url: whats-new/fsharp-10.md - text: "What's new in F# 9" url: whats-new/fsharp-9.md - text: "What's new in F# 8" diff --git a/docs/fsharp/language-reference/computation-expressions.md b/docs/fsharp/language-reference/computation-expressions.md index 75d668b36d595..f3224cae1fcd4 100644 --- a/docs/fsharp/language-reference/computation-expressions.md +++ b/docs/fsharp/language-reference/computation-expressions.md @@ -264,6 +264,7 @@ The following table describes methods that can be used in a workflow builder cla |`Delay`|`(unit -> M<'T>) -> Delayed<'T>`|Wraps a computation expression as a function. `Delayed<'T>` can be any type, commonly `M<'T>` or `unit -> M<'T>` are used. The default implementation returns a `M<'T>`.| |`Return`|`'T -> M<'T>`|Called for `return` in computation expressions.| |`ReturnFrom`|`M<'T> -> M<'T>`|Called for `return!` in computation expressions.| +|`ReturnFromFinal`|`M<'T> -> M<'T>`|If present, called for `return!` and `do!` when in tail-call position.| |`BindReturn`|`(M<'T1> * ('T1 -> 'T2)) -> M<'T2>`|Called for an efficient `let! ... return` in computation expressions.| |`BindNReturn`|`(M<'T1> * M<'T2> * ... * M<'TN> * ('T1 * 'T2 ... * 'TN -> M<'U>)) -> M<'U>`|Called for efficient `let! ... and! ... return` in computation expressions without merging inputs.

for example, `Bind3Return`, `Bind4Return`.| |`MergeSources`|`(M<'T1> * M<'T2>) -> M<'T1 * 'T2>`|Called for `and!` in computation expressions.| @@ -277,6 +278,7 @@ The following table describes methods that can be used in a workflow builder cla |`While`|`(unit -> bool) * Delayed<'T> -> M<'T>`or

`(unit -> bool) * Delayed -> M`|Called for `while...do` expressions in computation expressions.| |`Yield`|`'T -> M<'T>`|Called for `yield` expressions in computation expressions.| |`YieldFrom`|`M<'T> -> M<'T>`|Called for `yield!` expressions in computation expressions.| +|`YieldFromFinal`|`M<'T> -> M<'T>`|If present, called for `yield!` when in tail-call position and in case of `do!` in tail-call position as a fallback for `ReturnFromFinal`| |`Zero`|`unit -> M<'T>`|Called for empty `else` branches of `if...then` expressions in computation expressions.| |`Quote`|`Quotations.Expr<'T> -> Quotations.Expr<'T>`|Indicates that the computation expression is passed to the `Run` member as a quotation. It translates all instances of a computation into a quotation.| diff --git a/docs/fsharp/language-reference/parameters-and-arguments.md b/docs/fsharp/language-reference/parameters-and-arguments.md index 7d0cf9bce6a2a..8bd34a52c5ac2 100644 --- a/docs/fsharp/language-reference/parameters-and-arguments.md +++ b/docs/fsharp/language-reference/parameters-and-arguments.md @@ -150,6 +150,18 @@ Baud Rate: 9600 Duplex: Full Parity: false Baud Rate: 4800 Duplex: Half Parity: false ``` +You can also specify an optional parameter to be a [Value Option](./value-options.md) type by applying a `[]` attribute to it. + +```fsharp +type T() = + static member M([] ?p : string) = + match p with + | ValueSome s -> printfn "%s" s + | ValueNone -> printfn "None" +``` + +When using struct-backed optional parameter, as seen above, you would use `defaultValueArg` instead of `defaultArg` to set the default value of the parameter. + ### Optional parameters (C# interop) For the purposes of C# interop, you can use the attributes `[]` in F#, so that callers will see an argument as optional. This is equivalent to defining the argument as optional in C# as in `MyMethod(int i = 3)`. This form was introduced in F# 4.1 to help facilitate interoperation with C# code. diff --git a/docs/fsharp/toc.yml b/docs/fsharp/toc.yml index 4572ae9e0f489..10152aed6f12f 100644 --- a/docs/fsharp/toc.yml +++ b/docs/fsharp/toc.yml @@ -292,6 +292,8 @@ items: href: tutorials/using-functions.md - name: What's new items: + - name: F# 10 + href: whats-new/fsharp-10.md - name: F# 9 href: whats-new/fsharp-9.md - name: F# 8 diff --git a/docs/fsharp/whats-new/fsharp-10.md b/docs/fsharp/whats-new/fsharp-10.md new file mode 100644 index 0000000000000..89f04310bb1e1 --- /dev/null +++ b/docs/fsharp/whats-new/fsharp-10.md @@ -0,0 +1,401 @@ +--- +title: What's new in F# 10 - F# Guide +description: Get an overview of the new features available in F# 10. +ms.date: 11/11/2025 +ms.topic: whats-new +ai-usage: ai-assisted +--- +# What's new in F# 10 + +F# 10 brings you several improvements to the F# language, FSharp.Core library, and tooling. +This version is a refinement release focused on clarity, consistency, and performance, with small but meaningful improvements that make your everyday code more legible and robust. +F# 10 ships with **.NET 10** and **Visual Studio 2026**. + +You can download the latest .NET SDK from the [.NET downloads page](https://dotnet.microsoft.com/download). + +## Get started + +F# 10 is available in all .NET Core distributions and Visual Studio tooling. +For more information, see [Get started with F#](../get-started/index.md). + +## Scoped warning suppression + +You can now suppress warnings in specific sections of your code using the new `#warnon` directive. +This pairs with the [existing `#nowarn` directive](../language-reference/compiler-directives.md#warn-directives) to give you precise control over which warnings apply where. + +Previously, when you used `#nowarn`, it would disable a warning for the remainder of the file, which could suppress legitimate issues elsewhere. +Let's look at a motivating example: + +```fsharp +// We know f is never called with None. +let f (Some a) = // creates warning 25, which we want to suppress + // 2000 loc, where the incomplete match warning is beneficial +``` + +If you add `#nowarn 25` above the function definition, it disables FS0025 for the entire remainder of the file. + +With F# 10, you can now mark the exact section where you want the warning suppressed: + +```fsharp +#nowarn 25 +let f (Some x) = // FS0025 suppressed +#warnon 25 + // FS0025 enabled again +``` + +Conversely, if a warning is disabled globally (for example, via a compiler flag), you can enable it locally with `#warnon`. +This directive will apply until a matching `#nowarn` or the end of the file. + +**Important compatibility notes:** + +This feature includes several changes that improve the consistency of `#nowarn`/`#warnon` directives. +These are breaking changes: + +* The compiler no longer allows multiline and empty warn directives. +* The compiler no longer allows whitespace between `#` and `nowarn`. +* You cannot use triple-quoted, interpolated, or verbatim strings for warning numbers. + +Script behavior has also changed. +Previously, when you added a `#nowarn` directive anywhere in a script, it applied to the whole compilation. +Now, its behavior in scripts matches that in `.fs` files, applying only until the end of the file or a corresponding `#warnon`. + +This feature implements [RFC FS-1146](https://github.com/fsharp/fslang-design/blob/main/RFCs/FS-1146-scoped-nowarn.md). + +## Access modifiers on auto property accessors + +A common pattern in object-oriented programming is to create publicly readable but privately mutable state. +Before F# 10, you needed explicit [property syntax](../language-reference/members/properties.md) with backing fields (hidden variables that store the actual property values) to achieve this, which added repetitive code: + +```fsharp +type Ledger() = + [] val mutable private _Balance: decimal + member this.Balance with public get() = this._Balance and private set v = this._Balance <- v +``` + +With F# 10, you can now apply different access modifiers to individual property accessors. +This lets you specify different access levels for the getter and setter of a property, making the pattern much simpler: + +```fsharp +type Ledger() = + member val Balance = 0m with public get, private set +``` + +You can place an access modifier either before the property name (applying to both accessors) or before individual accessors, but not both simultaneously. + +Note that this feature does not extend to signature (`.fsi`) files. +The correct signature for the `Ledger` example above is: + +```fsharp +type Ledger() = + member Balance : decimal + member private Balance : decimal with set +``` + +This feature implements [RFC FS-1141](https://github.com/fsharp/fslang-design/blob/main/RFCs/FS-1141-Allow-access-modifiers-to-auto-properties-getters-and-setters.md). + +## ValueOption optional parameters + +You can now use a struct-based [`ValueOption<'T>`](../language-reference/value-options.md) representation for [optional parameters](../language-reference/parameters-and-arguments.md#optional-parameters-f-native). +When you apply the `[]` attribute to an optional parameter, the compiler uses `ValueOption<'T>` instead of the reference-based `option` type. +This avoids heap allocations (memory allocated on the managed heap that requires garbage collection) for the option wrapper, which is beneficial in performance-critical code. + +Previously, F# always used the heap-allocated `option` type for optional parameters, even when the parameter was absent: + +```fsharp +// Prior to F# 10: always uses reference option +type X() = + static member M(?x : string) = + match x with + | Some v -> printfn "Some %s" v + | None -> printfn "None" +``` + +In F# 10, you can use the `[]` attribute to leverage the struct-backed `ValueOption`: + +```fsharp +type X() = + static member M([] ?x : string) = + match x with + | ValueSome v -> printfn "ValueSome %s" v + | ValueNone -> printfn "ValueNone" +``` + +This eliminates heap allocations when the argument is absent, which is beneficial in performance-critical code. + +Choose this struct-based option for small values or frequently constructed types where allocation pressure matters. +Use the default reference-based `option` when you rely on existing pattern matching helpers, need reference semantics, or when the performance difference is negligible. +This feature strengthens parity with other F# language constructs that already support `ValueOption`. + +## Tail-call support in computation expressions + +F# 10 adds [tail-call](../language-reference/functions/recursive-functions-the-rec-keyword.md#tail-recursion) optimizations for [computation expressions](../language-reference/computation-expressions.md). +Computation-expression builders can now opt into these optimizations by implementing special methods. + +When the compiler translates computation expressions into regular F# code (a process called desugaring), it recognizes when an expression like `return!`, `yield!`, or `do!` appears in a tail position. +If your builder provides the following methods, the compiler routes those calls to optimized entry points: + +* `ReturnFromFinal` - called for a tail `return!` (falls back to `ReturnFrom` if absent) +* `YieldFromFinal` - called for a tail `yield!` (falls back to `YieldFrom` if absent) +* For a terminal `do!`, the compiler prefers `ReturnFromFinal`, then `YieldFromFinal`, before falling back to the normal `Bind` pathway + +These `*Final` members are optional and exist purely to enable optimization. +Builders that do not provide these members keep their existing semantics unchanged. + +For example: + +```fsharp +coroutine { + yield! subRoutine() // tail position -> YieldFromFinal if available +} +``` + +However, in a non-tail position: + +```fsharp +coroutine { + try + yield! subRoutine() // not tail -> normal YieldFrom + finally () +} +``` + +**Important compatibility note:** + +This change can be breaking if a computation expression builder already defines members with these names. +In most cases, existing builders continue to work without modification when compiled with F# 10. +Older compilers will ignore the new `*Final` methods, so builders that must remain compatible with earlier compiler versions should not assume the compiler will invoke these methods. + +This feature implements [RFC FS-1330](https://github.com/fsharp/fslang-design/blob/main/RFCs/FS-1330-support-tailcalls-in-computation-expressions.md). + +## Typed bindings in computation expressions without parentheses + +F# 10 removes the requirement for parentheses when adding type annotations to computation expression bindings. +You can now add type annotations on `let!`, `use!`, and `and!` bindings using the same syntax as ordinary `let` bindings. + +Previously, you had to use parentheses for type annotations: + +```fsharp +async { + let! (a: int) = fetchA() + and! (b: int) = fetchB() + use! (d: MyDisposable) = acquireAsync() + return a + b +} +``` + +In F# 10, you can write type annotations without parentheses: + +```fsharp +async { + let! a: int = fetchA() + and! b: int = fetchB() + use! d: MyDisposable = acquireAsync() + return a + b +} +``` + +## Allow `_` in `use!` bindings + +You can now use the discard pattern (`_`) in `use!` bindings within computation expressions. +This aligns the behavior of `use!` with regular `use` bindings. + +Previously, the compiler rejected the discard pattern in `use!` bindings, forcing you to create throwaway identifiers: + +```fsharp +counterDisposable { + use! _ignored = new Disposable() + // logic +} +``` + +In F# 10, you can use the discard pattern directly: + +```fsharp +counterDisposable { + use! _ = new Disposable() + // logic +} +``` + +This clarifies intent when binding asynchronous resources whose values are only needed for lifetime management. + +## Rejecting pseudo-nested modules in types + +The compiler now raises an error when you place a `module` declaration indented at the same structural level inside a type definition. +This tightens structural validation to reject misleading module placement within types. + +Previously, the compiler accepted `module` declarations indented within type definitions, but it actually created these modules as siblings to the type rather than nesting them within it: + +```fsharp +type U = + | A + | B + module M = // Silently created a sibling module, not nested + let f () = () +``` + +With F# 10, this pattern raises error FS0058, forcing you to clarify your intent with proper module placement: + +```fsharp +type U = + | A + | B + +module M = + let f () = () +``` + +## Deprecation warning for omitted `seq` + +The compiler now warns you about bare sequence expressions that omit the `seq` builder. +When you use bare range braces like `{ 1..10 }`, you'll see a deprecation warning encouraging you to use the explicit `seq { ... }` form. + +Historically, F# allowed a special-case "sequence comprehension lite" syntax where you could omit the `seq` keyword: + +```fsharp +{ 1..10 } |> List.ofSeq // implicit sequence, warning FS3873 in F# 10 +``` + +In F# 10, the compiler warns about this pattern and encourages the explicit form: + +```fsharp +seq { 1..10 } |> List.ofSeq +``` + +This is currently a warning, not an error, giving you time to update your codebase. +If you want to suppress this warning, use the `NoWarn` property in your project file or `#nowarn` directive locally and pass it the warning number: 3873. + +The explicit `seq` form improves code clarity and consistency with other computation expressions. +Future versions of F# may make this an error, so we recommend adopting the explicit syntax when you update your code. + +This feature implements [RFC FS-1033](https://github.com/fsharp/fslang-design/blob/main/RFCs/FS-1033-Deprecate-places-where-seq-can-be-omitted.md). + +## Attribute target enforcement + +F# 10 enforces attribute target validation across all language constructs. +The compiler now validates that attributes are only applied to their intended targets by checking `AttributeTargets` across let-bound values, functions, union cases, implicit constructors, structs, and classes. + +Previously, the compiler silently allowed you to misapply attributes to incompatible targets. +This caused subtle bugs, such as test attributes being ignored when you forgot `()` to make a function: + +```fsharp +[] +let ``this is not a function`` = // Silently ignored in F# 9, not a test! + Assert.True(false) +``` + +In F# 10, the compiler enforces attribute targets and raises a warning when attributes are misapplied: + +```fsharp +[] +//^^^^ - warning FS0842: This attribute cannot be applied to property, field, return value. Valid targets are: method +let ``this is not a function`` = + Assert.True(false) +``` + +**Important compatibility note:** + +This is a breaking change that may reveal previously silent issues in your codebase. +The early errors prevent test discovery problems and ensure that attributes like analyzers and decorators take effect as intended. + +## Support for `and!` in task expressions + +You can now await multiple tasks concurrently using [`and!`](../language-reference/computation-expressions.md#and) in [task expressions](../language-reference/task-expressions.md). +Using `task` is a popular way to work with asynchronous workflows in F#, especially when you need interoperability with C#. +However, until now, there was no concise way to await multiple tasks concurrently in a computation expression. + +Perhaps you started with code that awaited computations sequentially: + +```fsharp +// Awaiting sequentially +task { + let! a = fetchA() + let! b = fetchB() + return combineAB a b +} +``` + +If you then wanted to change it to await them concurrently, you would typically use `Task.WhenAll`: + +```fsharp +// Use explicit Task combinator to await concurrently +task { + let ta = fetchA() + let tb = fetchB() + let! results = Task.WhenAll([| ta; tb |]) + return combineAB ta.Result tb.Result +} +``` + +In F# 10, you can use `and!` for a more idiomatic approach: + +```fsharp +task { + let! a = fetchA() + and! b = fetchB() + return combineAB a b +} +``` + +This combines the semantics of the concurrent version with the simplicity of the sequential version. + +This feature implements F# language suggestion [#1363](https://github.com/fsharp/fslang-suggestions/issues/1363), and it's implemented as an addition to the `FSharp.Core` library. +Most projects get the latest version of `FSharp.Core` automatically from the compiler, unless they explicitly pin a version. +In that case, you'll need to update it to use this feature. + +## Better trimming by default + +F# 10 removes a long-standing bit of friction with trimming F# assemblies. +Trimming is the process of removing unused code from your published application to reduce its size. +You no longer have to manually maintain an `ILLink.Substitutions.xml` file just to strip large F# metadata resource blobs (signature and optimization data that the compiler uses but your application doesn't need at runtime). + +When you publish with trimming enabled (`PublishTrimmed=true`), the F# build now automatically generates an embedded substitutions file that targets these tooling-only F# resources. + +Previously, you had to manually maintain this file to strip the metadata. +This added maintenance burden and was easy to forget. + +The result is smaller output by default, less repetitive code to maintain, and one fewer maintenance hazard. +If you need full manual control, you can still add your own substitutions file. +You can turn off the auto-generation with the `false` property. + +## Parallel compilation in preview + +An exciting update for F# users looking to reduce compilation times: the parallel compilation features are stabilizing. +Starting with .NET 10, three features: graph-based type checking, parallel IL code generation, and parallel optimization, are grouped together under the `ParallelCompilation` project property. + +F# 10 enables this setting by default for projects using `LangVersion=Preview`. +We plan to enable it for all projects in .NET 11. + +Be sure to give it a try and see if it speeds up your compilation. +To enable parallel compilation in F# 10: + +```xml + + true + false + +``` + +If you want to opt out while still enjoying other preview features, set `ParallelCompilation` to false: + +```xml + + Preview + false + +``` + +Parallel compilation can significantly reduce compilation times for projects with multiple files and dependencies. + +## Type subsumption cache + +The compiler now caches type relationship checks to speed up type inference and improve IDE performance, particularly when working with complex type hierarchies. +By storing and reusing results from previous subsumption checks, the compiler avoids redundant computations that previously slowed down compilation and IntelliSense. + +**Managing the cache:** + +In most cases, the type subsumption cache improves performance without any configuration. +However, if you experience increased memory footprint or increased CPU usage (due to cache maintenance workers), you can adjust the cache behavior: + +* To disable the cache entirely, set `9` in your project file to fall back to F# 9 behavior. +* To turn off asynchronous cache eviction (which increases thread pressure) and use synchronous eviction instead, set the `FSharp_CacheEvictionImmediate=1` environment variable. From 90e749fcd6c4d7f7d702755f2d33d914b6d8f021 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 10 Nov 2025 16:46:26 +0000 Subject: [PATCH 29/38] Add documentation for IDE0360, IDE0370, and IDE0380 code style rules (#49681) --- .../code-analysis/style-rules/ide0360.md | 79 +++++++++++++++ .../code-analysis/style-rules/ide0370.md | 76 +++++++++++++++ .../code-analysis/style-rules/ide0380.md | 97 +++++++++++++++++++ .../code-analysis/style-rules/index.md | 3 + .../style-rules/language-rules.md | 8 +- docs/navigate/tools-diagnostics/toc.yml | 6 ++ 6 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 docs/fundamentals/code-analysis/style-rules/ide0360.md create mode 100644 docs/fundamentals/code-analysis/style-rules/ide0370.md create mode 100644 docs/fundamentals/code-analysis/style-rules/ide0380.md diff --git a/docs/fundamentals/code-analysis/style-rules/ide0360.md b/docs/fundamentals/code-analysis/style-rules/ide0360.md new file mode 100644 index 0000000000000..8e28ae61771be --- /dev/null +++ b/docs/fundamentals/code-analysis/style-rules/ide0360.md @@ -0,0 +1,79 @@ +--- +title: "IDE0360: Simplify property accessor" +description: "Learn about code analysis rule IDE0360: Simplify property accessor" +ms.date: 11/08/2025 +f1_keywords: +- IDE0360 +helpviewer_keywords: +- IDE0360 +dev_langs: +- CSharp +ai-usage: ai-assisted +--- +# Simplify property accessor (IDE0360) + +| Property | Value | +|--------------------------|-----------------------------------------------| +| **Rule ID** | IDE0360 | +| **Title** | Simplify property accessor | +| **Category** | Style | +| **Subcategory** | Language rules (expression-level preferences) | +| **Applicable languages** | C# 13+ | +| **Options** | `csharp_style_prefer_simple_property_accessors` | + +## Overview + +This rule flags places where a property accessor that directly accesses the `field` keyword (C# 13+) can be simplified. When a property accessor only returns `field` or assigns a value to `field`, it can be simplified to a simple auto-accessor. + +## Options + +Options specify the behavior that you want the rule to enforce. For information about configuring options, see [Option format](language-rules.md#option-format). + +### csharp_style_prefer_simple_property_accessors + +| Property | Value | Description | +|-------------------|-----------------------------------------------|-------------------| +| **Option name** | `csharp_style_prefer_simple_property_accessors` | | +| **Option values** | `true` | Prefer simplified property accessors | +| | `false` | Disables the rule | +| **Default option value** | `true` | | + +## Example + +```csharp +// Code with violations. +public int Prop +{ + get { return field; } + set { field = (value > 0) ? value : throw new ArgumentException(); } +} + +// Fixed code. +public int Prop { get; set; } +``` + +## Suppress a warning + +If you want to suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the rule. + +```csharp +#pragma warning disable IDE0360 +// The code that's violating the rule is on this line. +#pragma warning restore IDE0360 +``` + +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_diagnostic.IDE0360.severity = none +``` + +To disable all of the code-style rules, set the severity for the category `Style` to `none` in the [configuration file](../configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_analyzer_diagnostic.category-Style.severity = none +``` + +For more information, see [How to suppress code analysis warnings](../suppress-warnings.md). diff --git a/docs/fundamentals/code-analysis/style-rules/ide0370.md b/docs/fundamentals/code-analysis/style-rules/ide0370.md new file mode 100644 index 0000000000000..020138eba0531 --- /dev/null +++ b/docs/fundamentals/code-analysis/style-rules/ide0370.md @@ -0,0 +1,76 @@ +--- +title: "IDE0370: Remove unnecessary suppression" +description: "Learn about code analysis rule IDE0370: Remove unnecessary suppression" +ms.date: 11/08/2025 +f1_keywords: +- IDE0370 +helpviewer_keywords: +- IDE0370 +dev_langs: +- CSharp +ai-usage: ai-assisted +--- +# Remove unnecessary suppression (IDE0370) + +| Property | Value | +|--------------------------|--------------------------------------------------| +| **Rule ID** | IDE0370 | +| **Title** | Remove unnecessary suppression | +| **Category** | Style | +| **Subcategory** | Unnecessary code rules (suppression preferences) | +| **Applicable languages** | C# | +| **Options** | None | + +## Overview + +This rule identifies unnecessary nullable warning suppressions using the [null-forgiving operator](../../../csharp/language-reference/operators/null-forgiving.md) (`!`). The null-forgiving operator tells the compiler that the value is not null, which suppresses warnings for nullable reference types. However, when the compiler can already determine that a value is not null, the null-forgiving operator is unnecessary and can be removed. + +## Example + +```csharp +// Code with violations. +#nullable enable + +void ProcessValue() +{ + List names = new()!; +} + +// Fixed code. +#nullable enable + +void ProcessValue() +{ + List names = new(); // No suppression needed. +} +``` + +## Suppress a warning + +If you want to suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the rule. + +```csharp +#pragma warning disable IDE0370 +// The code that's violating the rule is on this line. +#pragma warning restore IDE0370 +``` + +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_diagnostic.IDE0370.severity = none +``` + +To disable all of the code-style rules, set the severity for the category `Style` to `none` in the [configuration file](../configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_analyzer_diagnostic.category-Style.severity = none +``` + +For more information, see [How to suppress code analysis warnings](../suppress-warnings.md). + +## See also + +- [Nullable reference types](../../../csharp/nullable-references.md) diff --git a/docs/fundamentals/code-analysis/style-rules/ide0380.md b/docs/fundamentals/code-analysis/style-rules/ide0380.md new file mode 100644 index 0000000000000..a42dc99114354 --- /dev/null +++ b/docs/fundamentals/code-analysis/style-rules/ide0380.md @@ -0,0 +1,97 @@ +--- +title: "IDE0380: Remove unnecessary 'unsafe' modifier" +description: "Learn about code analysis rule IDE0380: Remove unnecessary 'unsafe' modifier" +ms.date: 11/08/2025 +f1_keywords: +- IDE0380 +helpviewer_keywords: +- IDE0380 +dev_langs: +- CSharp +ai-usage: ai-assisted +--- +# Remove unnecessary `unsafe` modifier (IDE0380) + +| Property | Value | +|--------------------------|-----------------------------------------------| +| **Rule ID** | IDE0380 | +| **Title** | Remove unnecessary `unsafe` modifier | +| **Category** | Style | +| **Subcategory** | Unnecessary code rules (modifier preferences) | +| **Applicable languages** | C# | +| **Options** | None | + +## Overview + +This rule identifies code blocks, methods, types, or other declarations marked with the `unsafe` modifier that don't actually contain any unsafe operations. The `unsafe` modifier allows the use of pointers and other unsafe code features, but when those features aren't being used, the modifier is unnecessary and should be removed for code clarity. + +## Example + +```csharp +// Code with violations. + +// Unnecessary, no unsafe operations. +unsafe class MyClass +{ + public void Method() + { + var x = 5; + } +} + +// Unnecessary, no unsafe operations. +unsafe void ProcessData(int value) +{ + Console.WriteLine(value); +} + +// Fixed code. +class MyClass +{ + public void Method() + { + var x = 5; + } +} + +void ProcessData(int value) +{ + Console.WriteLine(value); +} + +// Example where 'unsafe' is needed. +unsafe class ValidUsage +{ + int* pointer; // Pointer type requires 'unsafe'. +} +``` + +## Suppress a warning + +If you want to suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the rule. + +```csharp +#pragma warning disable IDE0380 +// The code that's violating the rule is on this line. +#pragma warning restore IDE0380 +``` + +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_diagnostic.IDE0380.severity = none +``` + +To disable all of the code-style rules, set the severity for the category `Style` to `none` in the [configuration file](../configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_analyzer_diagnostic.category-Style.severity = none +``` + +For more information, see [How to suppress code analysis warnings](../suppress-warnings.md). + +## See also + +- [Unsafe code, pointer types, and function pointers](../../../csharp/language-reference/unsafe-code.md) diff --git a/docs/fundamentals/code-analysis/style-rules/index.md b/docs/fundamentals/code-analysis/style-rules/index.md index fec923289f122..7060e750e061e 100644 --- a/docs/fundamentals/code-analysis/style-rules/index.md +++ b/docs/fundamentals/code-analysis/style-rules/index.md @@ -146,6 +146,9 @@ The following table list all the code-style rules by ID and [options](../code-st > | [IDE0330](ide0330.md) | Prefer 'System.Threading.Lock' | [csharp_prefer_system_threading_lock](ide0330.md#csharp_prefer_system_threading_lock) | > | [IDE0340](ide0340.md) | Use unbound generic type | [csharp_style_prefer_unbound_generic_type_in_nameof](ide0340.md#csharp_style_prefer_unbound_generic_type_in_nameof) | > | [IDE0350](ide0350.md) | Use implicitly typed lambda | [csharp_style_prefer_implicitly_typed_lambda_expression](ide0350.md#csharp_style_prefer_implicitly_typed_lambda_expression) | +> | [IDE0360](ide0360.md) | Simplify property accessor | [csharp_style_prefer_simple_property_accessors](ide0360.md#csharp_style_prefer_simple_property_accessors) | +> | [IDE0370](ide0370.md) | Remove unnecessary suppression | | +> | [IDE0380](ide0380.md) | Remove unnecessary 'unsafe' modifier | | > | [IDE1005](ide1005.md) | Use conditional delegate call | [csharp_style_conditional_delegate_call](ide1005.md#csharp_style_conditional_delegate_call) | > | [IDE1006](naming-rules.md) | Naming styles | | > | [IDE2000](ide2000.md) | Avoid multiple blank lines | [dotnet_style_allow_multiple_blank_lines_experimental](ide2000.md#dotnet_style_allow_multiple_blank_lines_experimental)† | diff --git a/docs/fundamentals/code-analysis/style-rules/language-rules.md b/docs/fundamentals/code-analysis/style-rules/language-rules.md index bd86cd6744ebd..6ca1f966d419c 100644 --- a/docs/fundamentals/code-analysis/style-rules/language-rules.md +++ b/docs/fundamentals/code-analysis/style-rules/language-rules.md @@ -1,7 +1,7 @@ --- title: Code-style language and unnecessary code rules description: Learn about the different code-style rules for using C# and Visual Basic language constructs and for finding unnecessary code. -ms.date: 03/25/2025 +ms.date: 11/07/2025 helpviewer_keywords: - language code style rules [EditorConfig] - language rules @@ -172,6 +172,7 @@ C# style rules: - [Use collection expression for new (IDE0306)](ide0306.md) - [Use unbound generic type (IDE0340)](ide0340.md) - [Use implicitly typed lambda (IDE0350)](ide0350.md) +- [Simplify property accessor (IDE0360)](ide0360.md) Visual Basic style rules: @@ -205,6 +206,7 @@ C# style rules: - [Struct can be made 'readonly' (IDE0250)](ide0250.md) - [Member can be made 'readonly' (IDE0251)](ide0251.md) - [Make anonymous function static (IDE0320)](ide0320.md) +- [Remove unnecessary `unsafe` modifier (IDE0380)](ide0380.md) ### New-line preferences @@ -259,6 +261,10 @@ C# style rules: - [Remove unnecessary suppression (IDE0079)](ide0079.md) +C# style rules: + +- [Remove unnecessary suppression (null-forgiving operator) (IDE0370)](ide0370.md) + ### `This.` and `me.` preferences .NET style rules (C# and Visual Basic): diff --git a/docs/navigate/tools-diagnostics/toc.yml b/docs/navigate/tools-diagnostics/toc.yml index 3bfea72f9aa3b..ef7767c738afb 100644 --- a/docs/navigate/tools-diagnostics/toc.yml +++ b/docs/navigate/tools-diagnostics/toc.yml @@ -3874,6 +3874,12 @@ items: href: ../../fundamentals/code-analysis/style-rules/ide0340.md - name: IDE0350 href: ../../fundamentals/code-analysis/style-rules/ide0350.md + - name: IDE0360 + href: ../../fundamentals/code-analysis/style-rules/ide0360.md + - name: IDE0370 + href: ../../fundamentals/code-analysis/style-rules/ide0370.md + - name: IDE0380 + href: ../../fundamentals/code-analysis/style-rules/ide0380.md - name: IDE1005 href: ../../fundamentals/code-analysis/style-rules/ide1005.md - name: IDE2000 From 280f8d772af006991ce5f189671c2f71bb24f542 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 10 Nov 2025 08:54:09 -0800 Subject: [PATCH 30/38] Add clarification that hosting APIs require framework-dependent deployments (#49595) --- docs/core/tutorials/netcore-hosting.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/core/tutorials/netcore-hosting.md b/docs/core/tutorials/netcore-hosting.md index 9c7272d6d6d0c..4b56b3d22bbd7 100644 --- a/docs/core/tutorials/netcore-hosting.md +++ b/docs/core/tutorials/netcore-hosting.md @@ -24,6 +24,9 @@ You also need to build a .NET component to test the host with, so you should ins Hosting the .NET runtime is done with the `nethost` and `hostfxr` libraries' APIs. These entry points handle the complexity of finding and setting up the runtime for initialization and allow both launching a managed application and calling into a static managed method. +> [!IMPORTANT] +> The `nethost` and `hostfxr` hosting APIs only support framework-dependent deployments. Self-contained deployments should be treated as stand-alone executables. If you're evaluating deployment models for your application, use a framework-dependent deployment to ensure compatibility with these native hosting APIs. + ## Create a host using `nethost.h` and `hostfxr.h` A [sample host](https://github.com/dotnet/samples/tree/main/core/hosting) demonstrating the steps outlined in the tutorial below is available in the dotnet/samples GitHub repository. Comments in the sample clearly associate the numbered steps from this tutorial with where they're performed in the sample. For download instructions, see [Samples and Tutorials](../../samples-and-tutorials/index.md#view-and-download-samples). From cddfad62cd6aac27923224e1562bf8f1e17dba1a Mon Sep 17 00:00:00 2001 From: Scott Addie <10702007+scottaddie@users.noreply.github.com> Date: Mon, 10 Nov 2025 15:06:52 -0600 Subject: [PATCH 31/38] Update managed identity docs with latest best practices (#49696) * Update managed identity docs with latest best practices * React to feedback --- .../system-assigned-managed-identity.md | 2 +- .../implement-system-assigned-identity.md | 17 +--- .../implement-user-assigned-identity.md | 25 +---- .../Program.cs | 37 +------ .../user-assigned-managed-identity/Program.cs | 99 ++----------------- 5 files changed, 20 insertions(+), 160 deletions(-) diff --git a/docs/azure/sdk/authentication/system-assigned-managed-identity.md b/docs/azure/sdk/authentication/system-assigned-managed-identity.md index 6aade0f41920a..6cdf2404004b8 100644 --- a/docs/azure/sdk/authentication/system-assigned-managed-identity.md +++ b/docs/azure/sdk/authentication/system-assigned-managed-identity.md @@ -3,7 +3,7 @@ title: Authenticate Azure-hosted .NET apps to Azure resources using a system-ass description: Learn how to authenticate Azure-hosted .NET apps to other Azure services using a system-assigned managed identity. ms.topic: how-to ms.custom: devx-track-dotnet, engagement-fy23, devx-track-azurecli -ms.date: 02/06/2025 +ms.date: 11/10/2025 --- # Authenticate Azure-hosted .NET apps to Azure resources using a system-assigned managed identity diff --git a/docs/azure/sdk/includes/implement-system-assigned-identity.md b/docs/azure/sdk/includes/implement-system-assigned-identity.md index adcb6341d5ee1..725eb2634295f 100644 --- a/docs/azure/sdk/includes/implement-system-assigned-identity.md +++ b/docs/azure/sdk/includes/implement-system-assigned-identity.md @@ -1,6 +1,6 @@ --- ms.topic: include -ms.date: 02/12/2025 +ms.date: 11/10/2025 --- [!INCLUDE [implement-managed-identity-concepts](implement-managed-identity-concepts.md)] @@ -30,19 +30,10 @@ Azure services are accessed using specialized client classes from the various Az 1. Include the `Azure.Identity` and `Microsoft.Extensions.Azure` namespaces via `using` directives. 1. Register the Azure service client using the corresponding `Add`-prefixed extension method. -1. Pass an appropriate `TokenCredential` instance to the `UseCredential` method: - - Use `DefaultAzureCredential` when your app is running locally. - - Use `ManagedIdentityCredential` when your app is running in Azure. +1. Use an appropriate `TokenCredential` instance for the environment in which your app is running. When your app is running: + - In Azure, pass an instance of `ManagedIdentityCredential` to the `UseCredential` method. `ManagedIdentityCredential` discovers your managed identity configurations to authenticate to other services automatically. + - On your local development machine, an instance of `DefaultAzureCredential` is created on your behalf. Call `UseCredential` only if you want to [customize `DefaultAzureCredential`](../authentication/credential-chains.md#how-to-customize-defaultazurecredential) or use a different credential. `DefaultAzureCredential` looks in the environment variables for an application service principal or at locally installed developer tools, such as Visual Studio, for a set of developer credentials. :::code language="csharp" source="../snippets/authentication/system-assigned-managed-identity/Program.cs" id="snippet_MIC_UseCredential"::: -An alternative to the `UseCredential` method is to provide the credential to the service client directly: - -:::code language="csharp" source="../snippets/authentication/system-assigned-managed-identity/Program.cs" id="snippet_MIC"::: - --- - -The preceding code behaves differently depending on the environment where it's running: - -- On your local development workstation, `DefaultAzureCredential` looks in the environment variables for an application service principal or at locally installed developer tools, such as Visual Studio, for a set of developer credentials. -- When deployed to Azure, `ManagedIdentityCredential` discovers your managed identity configurations to authenticate to other services automatically. diff --git a/docs/azure/sdk/includes/implement-user-assigned-identity.md b/docs/azure/sdk/includes/implement-user-assigned-identity.md index b7567a661ad4f..639409a1500b5 100644 --- a/docs/azure/sdk/includes/implement-user-assigned-identity.md +++ b/docs/azure/sdk/includes/implement-user-assigned-identity.md @@ -1,6 +1,6 @@ --- ms.topic: include -ms.date: 02/12/2025 +ms.date: 11/10/2025 --- [!INCLUDE [implement-managed-identity-concepts](implement-managed-identity-concepts.md)] @@ -30,9 +30,9 @@ Azure services are accessed using specialized client classes from the various Az 1. Include the `Azure.Identity` and `Microsoft.Extensions.Azure` namespaces via `using` directives. 1. Register the Azure service client using the corresponding `Add`-prefixed extension method. -1. Pass an appropriate `TokenCredential` instance to the `UseCredential` method: - - Use `DefaultAzureCredential` when your app is running locally - - Use `ManagedIdentityCredential` when your app is running in Azure and configure either the client ID, resource ID, or object ID. +1. Use an appropriate `TokenCredential` instance for the environment in which your app is running. When your app is running: + - In Azure, pass an instance of `ManagedIdentityCredential` to the `UseCredential` method and configure either the client ID, resource ID, or object ID. `ManagedIdentityCredential` discovers your managed identity configurations to authenticate to other services automatically. + - On your local development machine, an instance of `DefaultAzureCredential` is created on your behalf. Call `UseCredential` only if you want to [customize `DefaultAzureCredential`](../authentication/credential-chains.md#how-to-customize-defaultazurecredential) or use a different credential. `DefaultAzureCredential` looks in the environment variables for an application service principal or at locally installed developer tools, such as Visual Studio, for a set of developer credentials. ## [Client ID](#tab/client-id) @@ -51,10 +51,6 @@ The client ID is used to identify a managed identity when configuring applicatio :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ClientId_UseCredential"::: - An alternative to the `UseCredential` method is to provide the credential to the service client directly: - - :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ClientId"::: - ## [Resource ID](#tab/resource-id) The resource ID uniquely identifies the managed identity resource within your Azure subscription using the following structure: @@ -76,10 +72,6 @@ Resource IDs can be built by convention, which makes them more convenient when w :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ResourceId_UseCredential"::: - An alternative to the `UseCredential` method is to provide the credential to the service client directly: - - :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ResourceId"::: - ## [Object ID](#tab/object-id) A principal ID is another name for an object ID. @@ -97,13 +89,4 @@ A principal ID is another name for an object ID. :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ObjectId_UseCredential"::: - An alternative to the `UseCredential` method is to provide the credential to the service client directly: - - :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ObjectId"::: - --- - -The preceding code behaves differently depending on the environment where it's running: - -- On your local development workstation, `DefaultAzureCredential` looks in the environment variables for an application service principal or at locally installed developer tools, such as Visual Studio, for a set of developer credentials. -- When deployed to Azure, `ManagedIdentityCredential` discovers your managed identity configurations to authenticate to other services automatically. diff --git a/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/Program.cs b/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/Program.cs index 7ee24b5450ab2..f6757d8a5c01b 100644 --- a/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/Program.cs +++ b/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/Program.cs @@ -1,7 +1,5 @@ using Azure.Identity; using Microsoft.Extensions.Azure; -using Azure.Storage.Blobs; -using Azure.Core; var builder = WebApplication.CreateBuilder(args); @@ -11,42 +9,15 @@ clientBuilder.AddBlobServiceClient( new Uri("https://.blob.core.windows.net")); - TokenCredential credential = null; - - if (builder.Environment.IsProduction()) + if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) { // Managed identity token credential discovered when running in Azure environments - credential = new ManagedIdentityCredential(); - } - else - { - // Running locally on dev machine - DO NOT use in production or outside of local dev - credential = new DefaultAzureCredential(); + ManagedIdentityCredential credential = new(ManagedIdentityId.SystemAssigned); + clientBuilder.UseCredential(credential); } - - clientBuilder.UseCredential(credential); }); #endregion snippet_MIC_UseCredential -#region snippet_MIC -TokenCredential credential = null; - -if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) -{ - // Managed identity token credential discovered when running in Azure environments - credential = new ManagedIdentityCredential(); -} -else -{ - // Running locally on dev machine - DO NOT use in production or outside of local dev - credential = new DefaultAzureCredential(); -} - -builder.Services.AddSingleton(_ => - new BlobServiceClient( - new Uri("https://.blob.core.windows.net"), credential)); -#endregion snippet_MIC - var app = builder.Build(); if (app.Environment.IsDevelopment()) @@ -82,4 +53,4 @@ internal record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) { public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); -} \ No newline at end of file +} diff --git a/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/Program.cs b/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/Program.cs index 3a2211ece4eda..db10a2a61e26b 100644 --- a/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/Program.cs +++ b/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/Program.cs @@ -1,6 +1,5 @@ using Azure.Identity; using Microsoft.Extensions.Azure; -using Azure.Storage.Blobs; using Azure.Core; var builder = WebApplication.CreateBuilder(args); @@ -50,43 +49,15 @@ void registerUsingClientId(WebApplicationBuilder builder) clientBuilder.AddBlobServiceClient( new Uri("https://.blob.core.windows.net")); - TokenCredential credential = null; - if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) { // Managed identity token credential discovered when running in Azure environments - credential = new ManagedIdentityCredential( + ManagedIdentityCredential credential = new( ManagedIdentityId.FromUserAssignedClientId("")); + clientBuilder.UseCredential(credential); } - else - { - // Running locally on dev machine - DO NOT use in production or outside of local dev - credential = new DefaultAzureCredential(); - } - - clientBuilder.UseCredential(credential); }); #endregion snippet_MIC_ClientId_UseCredential - - #region snippet_MIC_ClientId - TokenCredential credential = null; - - if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) - { - // Managed identity token credential discovered when running in Azure environments - credential = new ManagedIdentityCredential( - ManagedIdentityId.FromUserAssignedClientId("")); - } - else - { - // Running locally on dev machine - DO NOT use in production or outside of local dev - credential = new DefaultAzureCredential(); - } - - builder.Services.AddSingleton(_ => - new BlobServiceClient( - new Uri("https://.blob.core.windows.net"), credential)); - #endregion snippet_MIC_ClientId } void registerUsingObjectId(WebApplicationBuilder builder) @@ -97,43 +68,15 @@ void registerUsingObjectId(WebApplicationBuilder builder) clientBuilder.AddBlobServiceClient( new Uri("https://.blob.core.windows.net")); - TokenCredential credential = null; - if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) { // Managed identity token credential discovered when running in Azure environments - credential = new ManagedIdentityCredential( + ManagedIdentityCredential credential = new( ManagedIdentityId.FromUserAssignedObjectId("")); + clientBuilder.UseCredential(credential); } - else - { - // Running locally on dev machine - DO NOT use in production or outside of local dev - credential = new DefaultAzureCredential(); - } - - clientBuilder.UseCredential(credential); }); #endregion snippet_MIC_ObjectId_UseCredential - - #region snippet_MIC_ObjectId - TokenCredential credential = null; - - if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) - { - // Managed identity token credential discovered when running in Azure environments - credential = new ManagedIdentityCredential( - ManagedIdentityId.FromUserAssignedObjectId("")); - } - else - { - // Running locally on dev machine - DO NOT use in production or outside of local dev - credential = new DefaultAzureCredential(); - } - - builder.Services.AddSingleton(_ => - new BlobServiceClient( - new Uri("https://.blob.core.windows.net"), credential)); - #endregion snippet_MIC_ObjectId } @@ -145,46 +88,18 @@ void registerUsingResourceId(WebApplicationBuilder builder) clientBuilder.AddBlobServiceClient( new Uri("https://.blob.core.windows.net")); - TokenCredential credential = null; - if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) { // Managed identity token credential discovered when running in Azure environments - credential = new ManagedIdentityCredential( + ManagedIdentityCredential credential = new( ManagedIdentityId.FromUserAssignedResourceId(new ResourceIdentifier(""))); + clientBuilder.UseCredential(credential); } - else - { - // Running locally on dev machine - DO NOT use in production or outside of local dev - credential = new DefaultAzureCredential(); - } - - clientBuilder.UseCredential(credential); }); #endregion snippet_MIC_ResourceId_UseCredential - - #region snippet_MIC_ResourceId - TokenCredential credential = null; - - if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) - { - // Managed identity token credential discovered when running in Azure environments - credential = new ManagedIdentityCredential( - ManagedIdentityId.FromUserAssignedResourceId(new ResourceIdentifier(""))); - } - else - { - // Running locally on dev machine - DO NOT use in production or outside of local dev - credential = new DefaultAzureCredential(); - } - - builder.Services.AddSingleton(_ => - new BlobServiceClient( - new Uri("https://.blob.core.windows.net"), credential)); - #endregion snippet_MIC_ResourceId } internal record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) { public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); -} \ No newline at end of file +} From 0df9ec5ed2333e234b8fe3b4f9c9581e533b79af Mon Sep 17 00:00:00 2001 From: Tara Overfield Date: Mon, 10 Nov 2025 13:51:00 -0800 Subject: [PATCH 32/38] update CVE in 10B and typo in 10D (#49701) * update CVE in 10B and typo in 10D * Update docs/framework/release-notes/2025/10-14-october-cumulative-update.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../release-notes/2025/10-14-october-cumulative-update.md | 4 ++-- .../2025/10-28-october-cumulative-update-preview.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/framework/release-notes/2025/10-14-october-cumulative-update.md b/docs/framework/release-notes/2025/10-14-october-cumulative-update.md index 220281de0cac5..13547fd4da9f7 100644 --- a/docs/framework/release-notes/2025/10-14-october-cumulative-update.md +++ b/docs/framework/release-notes/2025/10-14-october-cumulative-update.md @@ -14,9 +14,9 @@ _Released October 14, 2025_ ### Security improvements -#### CVE-2025-21176 – Remote Code Execution vulnerability +#### CVE-2025-55248 – Information Disclosure vulnerability -This security update addresses a remote code execution vulnerability detailed in [CVE 2025-21176](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-21176). +This security update addresses an information disclosure vulnerability detailed in [CVE 2025-55248](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-55248). ### Quality and reliability improvements diff --git a/docs/framework/release-notes/2025/10-28-october-cumulative-update-preview.md b/docs/framework/release-notes/2025/10-28-october-cumulative-update-preview.md index 3f3b38c530813..ba9b2fcfe2573 100644 --- a/docs/framework/release-notes/2025/10-28-october-cumulative-update-preview.md +++ b/docs/framework/release-notes/2025/10-28-october-cumulative-update-preview.md @@ -20,7 +20,7 @@ There are no new security improvements in this release. This update is cumulativ #### .NET Runtime -Addresses an issue to update operating systeam calls for compliance with current standards. (*Applies to: .NET Framework 4.8.1*) +Addresses an issue to update operating system calls for compliance with current standards. (*Applies to: .NET Framework 4.8.1*) ## Known issues in this release From a6700752851247905fe69f9cc61899cf049503ed Mon Sep 17 00:00:00 2001 From: "Andy (Steve) De George" <67293991+adegeo@users.noreply.github.com> Date: Mon, 10 Nov 2025 13:57:23 -0800 Subject: [PATCH 33/38] Improve messaging around .NET Upgrade Assistant (#49674) * Alter include for upgrade assist; add to more articles * Restructure deprecation notice to lead with key information (#49677) * Initial plan * Restructure deprecation notice to lead with key information Co-authored-by: adegeo <67293991+adegeo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: adegeo <67293991+adegeo@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> --- .../includes/github-copilot-suggestion.md | 4 ++-- .../porting/upgrade-assistant-how-to-analyze.md | 2 ++ .../porting/upgrade-assistant-how-to-upgrade.md | 2 ++ docs/core/porting/upgrade-assistant-overview.md | 16 ---------------- docs/core/porting/upgrade-assistant-telemetry.md | 2 ++ docs/core/porting/upgrade-assistant-wcf.md | 2 ++ 6 files changed, 10 insertions(+), 18 deletions(-) diff --git a/docs/core/porting/includes/github-copilot-suggestion.md b/docs/core/porting/includes/github-copilot-suggestion.md index 1f413f4860abb..bf8200aa3d5f9 100644 --- a/docs/core/porting/includes/github-copilot-suggestion.md +++ b/docs/core/porting/includes/github-copilot-suggestion.md @@ -1,9 +1,9 @@ --- author: adegeo ms.author: adegeo -ms.date: 09/23/2025 +ms.date: 11/07/2025 ms.topic: include --- > [!IMPORTANT] -> Try the [GitHub Copilot app modernization chat agent](../github-copilot-app-modernization/overview.md). This agent analyzes your projects and dependencies, produces a step-by-step migration plan with targeted recommendations and automated code fixes, and commits each change so you can validate or roll back. It automates common porting tasks—updating project files, replacing deprecated APIs, and resolving build issues—so you can modernize faster with less manual effort. For more information, see [What is GitHub Copilot app modernization](../github-copilot-app-modernization/overview.md). +> .NET Upgrade Assistant is officially deprecated. Use the [GitHub Copilot app modernization chat agent](../github-copilot-app-modernization/overview.md) instead, which is included with Visual Studio 2026 and Visual Studio 2022 17.14.16 or later. This agent analyzes your projects and dependencies, produces a step-by-step migration plan with targeted recommendations and automated code fixes, and commits each change so you can validate or roll back. It automates common porting tasks—updating project files, replacing deprecated APIs, and resolving build issues—so you can modernize faster with less manual effort. diff --git a/docs/core/porting/upgrade-assistant-how-to-analyze.md b/docs/core/porting/upgrade-assistant-how-to-analyze.md index afc1f1c76b59b..3bf3c9bd070af 100644 --- a/docs/core/porting/upgrade-assistant-how-to-analyze.md +++ b/docs/core/porting/upgrade-assistant-how-to-analyze.md @@ -14,6 +14,8 @@ ms.date: 10/08/2024 This article teaches you how to perform code analysis on your projects with .NET Upgrade Assistant, using Visual Studio or the terminal. The analysis generates a report that you can browse to get more information about the upgrade. +[!INCLUDE [github-copilot-suggestion](includes/github-copilot-suggestion.md)] + ## Prerequisites - For Visual Studio, see [Install .NET Upgrade Assistant - Visual Studio extension](upgrade-assistant-install.md#visual-studio-extension). diff --git a/docs/core/porting/upgrade-assistant-how-to-upgrade.md b/docs/core/porting/upgrade-assistant-how-to-upgrade.md index 6d266124364ba..9806ecc1174c4 100644 --- a/docs/core/porting/upgrade-assistant-how-to-upgrade.md +++ b/docs/core/porting/upgrade-assistant-how-to-upgrade.md @@ -14,6 +14,8 @@ ms.date: 10/08/2024 The focus of this article is to provide the basic steps to upgrade a project with .NET Upgrade Assistant. This involves initiating the upgrade and reviewing the results. Based on how complex your project is, you might be required to perform manual updates to your code. +[!INCLUDE [github-copilot-suggestion](includes/github-copilot-suggestion.md)] + Some project types have specific guidance on upgrading. For more information, see [Supported project types](upgrade-assistant-overview.md#supported-project-types). ## Prerequisites diff --git a/docs/core/porting/upgrade-assistant-overview.md b/docs/core/porting/upgrade-assistant-overview.md index 5260ab914191b..5e594bc89e5a5 100644 --- a/docs/core/porting/upgrade-assistant-overview.md +++ b/docs/core/porting/upgrade-assistant-overview.md @@ -22,22 +22,6 @@ ms.date: 10/08/2024 .NET Upgrade Assistant includes an analysis engine that scans your projects and their dependencies. After the scan is complete, a report is generated with detailed information about performing an upgrade. You can use this information to upgrade either the entire project or specific parts of the project. - - ## Supported project types .NET Upgrade Assistant supports upgrading projects coded in either C# or Visual Basic. The following types of projects are supported: diff --git a/docs/core/porting/upgrade-assistant-telemetry.md b/docs/core/porting/upgrade-assistant-telemetry.md index 4168be61f7309..be68747e9d2b9 100644 --- a/docs/core/porting/upgrade-assistant-telemetry.md +++ b/docs/core/porting/upgrade-assistant-telemetry.md @@ -8,6 +8,8 @@ ms.date: 05/22/2023 The [Upgrade Assistant](./upgrade-assistant-overview.md) includes a telemetry feature that collects usage data. The telemetry data is used to help understand how to make improvements to the tool. +[!INCLUDE [github-copilot-suggestion](includes/github-copilot-suggestion.md)] + ## How to opt out The Upgrade Assistant telemetry feature is enabled by default. To opt out of the telemetry feature, set the `DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT` environment variable to `1` or `true`. diff --git a/docs/core/porting/upgrade-assistant-wcf.md b/docs/core/porting/upgrade-assistant-wcf.md index 2552866ed2151..ce83e021f761a 100644 --- a/docs/core/porting/upgrade-assistant-wcf.md +++ b/docs/core/porting/upgrade-assistant-wcf.md @@ -14,6 +14,8 @@ The .NET Upgrade Assistant is a command-line tool that can assist with upgrading - A demonstration of how to run the tool against a WCF Server-side project on .NET Framework. - Troubleshooting tips. +[!INCLUDE [github-copilot-suggestion](includes/github-copilot-suggestion.md)] + ## Things to know before starting This tool currently supports C# projects and uses [CoreWCF](https://github.com/corewcf/corewcf) to port self-hosted WCF Server-side projects to .NET 6. From 60f4d4f9b8018f1eb9f1fd666fd77d12248ad438 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Mon, 10 Nov 2025 14:19:46 -0800 Subject: [PATCH 34/38] Update package index with latest published versions (#49695) --- docs/azure/includes/dotnet-all.md | 7 ++++--- docs/azure/includes/dotnet-new.md | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 89e6780e1929c..8919371790ab8 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -116,6 +116,8 @@ | Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_1.0.0/sdk/translation/Azure.AI.Translation.Text/) | | Time Series Insights | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.IoT.TimeSeriesInsights/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/IoT.TimeSeriesInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.TimeSeriesInsights_1.0.0-beta.1/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/) | | TimeZone | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Maps.TimeZones/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Maps.TimeZones-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Maps.TimeZones_1.0.0-beta.1/sdk/maps/Azure.Maps.TimeZones/) | +| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.1/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | +| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.1/sdk/agentserver/Azure.AI.AgentServer.Core/) | | Vision Common | NuGet [0.15.1-beta.1](https://www.nuget.org/packages/Azure.AI.Vision.Common/0.15.1-beta.1) | | GitHub [0.15.1-beta.1](https://msasg.visualstudio.com/Skyman/_git/Carbon) | | Voice Live | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.0.0) | [docs](/dotnet/api/overview/azure/AI.VoiceLive-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.0.0/sdk/ai/Azure.AI.VoiceLive/) | | WCF Storage Queues | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.WCF.Azure.StorageQueues/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.WCF.Azure.StorageQueues-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.WCF.Azure.StorageQueues_1.0.0-beta.1/sdk/extension-wcf/Microsoft.WCF.Azure.StorageQueues/) | @@ -264,7 +266,6 @@ | Resource Management - Hardware Security Modules | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.HardwareSecurityModules/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.HardwareSecurityModules-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.HardwareSecurityModules_1.0.0/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/) | | Resource Management - Hci.Vm | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.Hci.Vm/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Hci.Vm-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Hci.Vm_1.0.0-beta.1/sdk/azurestackhci/Azure.ResourceManager.Hci.Vm/) | | Resource Management - HDInsight | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.HDInsight/1.1.0)
NuGet [1.2.0-beta.5](https://www.nuget.org/packages/Azure.ResourceManager.HDInsight/1.2.0-beta.5) | [docs](/dotnet/api/overview/azure/ResourceManager.HDInsight-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.HDInsight_1.1.0/sdk/hdinsight/Azure.ResourceManager.HDInsight/)
GitHub [1.2.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.HDInsight_1.2.0-beta.5/sdk/hdinsight/Azure.ResourceManager.HDInsight/) | -| Resource Management - HDInsight Containers | NuGet [1.0.0-beta.5](https://www.nuget.org/packages/Azure.ResourceManager.HDInsight.Containers/1.0.0-beta.5) | [docs](/dotnet/api/overview/azure/ResourceManager.HDInsight.Containers-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.HDInsight.Containers_1.0.0-beta.5/sdk/hdinsightcontainers/Azure.ResourceManager.HDInsight.Containers/) | | Resource Management - Health Bot | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.HealthBot/1.2.0) | [docs](/dotnet/api/overview/azure/ResourceManager.HealthBot-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.HealthBot_1.2.0/sdk/healthbot/Azure.ResourceManager.HealthBot/) | | Resource Management - Health Data AI Services | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.HealthDataAIServices/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.HealthDataAIServices-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.HealthDataAIServices_1.0.0/sdk/healthdataaiservices/Azure.ResourceManager.HealthDataAIServices/) | | Resource Management - Healthcare APIs | NuGet [1.3.1](https://www.nuget.org/packages/Azure.ResourceManager.HealthcareApis/1.3.1) | [docs](/dotnet/api/overview/azure/ResourceManager.HealthcareApis-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.HealthcareApis_1.3.1/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/) | @@ -536,8 +537,8 @@ | Functions extension for Azure SQL and SQL Server | NuGet [3.1.527](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Sql/3.1.527) | | | | Functions extension for Cosmos DB | NuGet [4.11.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.CosmosDB/4.11.0)
NuGet [4.12.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.CosmosDB/4.12.0-preview.1) | | GitHub [4.11.0](https://github.com/Azure/azure-webjobs-sdk-extensions/tree/cosmos-v3.0.7/src/WebJobs.Extensions.CosmosDB) | | Functions extension for DocumentDB | NuGet [1.3.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DocumentDB/1.3.0) | | GitHub [1.3.0](https://github.com/Azure/azure-webjobs-sdk-extensions) | -| Functions extension for Durable Task Framework | NuGet [3.6.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DurableTask/3.6.0) | [docs](/dotnet/api/overview/azure/functions) | GitHub [3.6.0](https://github.com/Azure/azure-functions-durable-extension/tree/v2.2.2/src/WebJobs.Extensions.DurableTask) | -| Functions extension for Durable Task Framework - isolated worker | NuGet [1.9.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.DurableTask/1.9.0) | | | +| Functions extension for Durable Task Framework | NuGet [3.7.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DurableTask/3.7.0) | [docs](/dotnet/api/overview/azure/functions) | GitHub [3.7.0](https://github.com/Azure/azure-functions-durable-extension/tree/v2.2.2/src/WebJobs.Extensions.DurableTask) | +| Functions extension for Durable Task Framework - isolated worker | NuGet [1.10.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.DurableTask/1.10.0) | | | | Functions extension for HTTP | NuGet [3.2.1](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Http/3.2.1) | | GitHub [3.2.1](https://github.com/Azure/azure-webjobs-sdk-extensions/tree/v3.0.2/src/WebJobs.Extensions.Http) | | Functions extension for IoT Edge | NuGet [1.0.7](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EdgeHub/1.0.7) | | GitHub [1.0.7](https://github.com/Azure/iotedge/tree/1.0.7/edge-hub) | | Functions extension for Kafka | NuGet [4.2.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Kafka/4.2.0) | | GitHub [4.2.0](https://github.com/Azure/azure-functions-kafka-extension/tree/3.0.0/src/Microsoft.Azure.WebJobs.Extensions.Kafka) | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index c130caa58020d..46720ff7e9774 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -124,6 +124,8 @@ | Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_1.0.0/sdk/translation/Azure.AI.Translation.Text/) | | Time Series Insights | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.IoT.TimeSeriesInsights/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/IoT.TimeSeriesInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.TimeSeriesInsights_1.0.0-beta.1/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/) | | TimeZone | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Maps.TimeZones/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Maps.TimeZones-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Maps.TimeZones_1.0.0-beta.1/sdk/maps/Azure.Maps.TimeZones/) | +| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.1/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | +| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.1/sdk/agentserver/Azure.AI.AgentServer.Core/) | | Video Analyzer Edge | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.Media.VideoAnalyzer.Edge/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Media.VideoAnalyzer.Edge-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Media.VideoAnalyzer.Edge_1.0.0-beta.6/sdk/videoanalyzer/Azure.Media.VideoAnalyzer.Edge/) | | Vision Common | NuGet [0.15.1-beta.1](https://www.nuget.org/packages/Azure.AI.Vision.Common/0.15.1-beta.1) | | GitHub [0.15.1-beta.1](https://msasg.visualstudio.com/Skyman/_git/Carbon) | | Voice Live | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.0.0) | [docs](/dotnet/api/overview/azure/AI.VoiceLive-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.0.0/sdk/ai/Azure.AI.VoiceLive/) | From ea11cd2408de69ec6e9e4c103f14e2a80061474c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Pir=C3=B3g?= Date: Tue, 11 Nov 2025 01:44:35 +0100 Subject: [PATCH 35/38] Vb.net: Fix typo in join clause syntax in documentation (#49704) Missing closing square bracket in the Syntax section --- docs/visual-basic/language-reference/queries/join-clause.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/visual-basic/language-reference/queries/join-clause.md b/docs/visual-basic/language-reference/queries/join-clause.md index 903ea51923ccb..a94706714b82c 100644 --- a/docs/visual-basic/language-reference/queries/join-clause.md +++ b/docs/visual-basic/language-reference/queries/join-clause.md @@ -22,7 +22,7 @@ Combines two collections into a single collection. The join operation is based o Join element In collection _ [ joinClause _ ] [ groupJoinClause ... _ ] -On key1 Equals key2 [ And key3 Equals key4 [... ] +On key1 Equals key2 [ And key3 Equals key4 [... ] ] ``` ## Parts From 587b466ec7afd856581dfbc097752a2a82f1f0ea Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 11 Nov 2025 06:19:14 -0800 Subject: [PATCH 36/38] Update package index with latest published versions (#49706) --- docs/azure/includes/dotnet-all.md | 6 +++--- docs/azure/includes/dotnet-new.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 8919371790ab8..6953b8ae29820 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -4,7 +4,7 @@ | AI Foundry | NuGet [1.1.0](https://www.nuget.org/packages/Azure.AI.Projects/1.1.0) | [docs](/dotnet/api/overview/azure/AI.Projects-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_1.1.0/sdk/ai/Azure.AI.Projects/) | | AI Model Inference | NuGet [1.0.0-beta.5](https://www.nuget.org/packages/Azure.AI.Inference/1.0.0-beta.5) | [docs](/dotnet/api/overview/azure/AI.Inference-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Inference_1.0.0-beta.5/sdk/ai/Azure.AI.Inference/) | | Anomaly Detector | NuGet [3.0.0-preview.7](https://www.nuget.org/packages/Azure.AI.AnomalyDetector/3.0.0-preview.7) | [docs](/dotnet/api/overview/azure/AI.AnomalyDetector-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [3.0.0-preview.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AnomalyDetector_3.0.0-preview.7/sdk/anomalydetector/Azure.AI.AnomalyDetector/) | -| App Configuration | NuGet [1.6.1](https://www.nuget.org/packages/Azure.Data.AppConfiguration/1.6.1) | [docs](/dotnet/api/overview/azure/Data.AppConfiguration-readme) | GitHub [1.6.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.AppConfiguration_1.6.1/sdk/appconfiguration/Azure.Data.AppConfiguration/) | +| App Configuration | NuGet [1.7.0](https://www.nuget.org/packages/Azure.Data.AppConfiguration/1.7.0) | [docs](/dotnet/api/overview/azure/Data.AppConfiguration-readme) | GitHub [1.7.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.AppConfiguration_1.7.0/sdk/appconfiguration/Azure.Data.AppConfiguration/) | | App Configuration Provider | NuGet [8.4.0](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.AzureAppConfiguration/8.4.0) | [docs](/dotnet/api/overview/azure/Microsoft.Extensions.Configuration.AzureAppConfiguration-readme) | GitHub [8.4.0](https://github.com/Azure/AppConfiguration-DotnetProvider) | | Attestation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Security.Attestation/1.0.0) | [docs](/dotnet/api/overview/azure/Security.Attestation-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.Attestation_1.0.0/sdk/attestation/Azure.Security.Attestation/) | | Azure AI Search | NuGet [11.7.0](https://www.nuget.org/packages/Azure.Search.Documents/11.7.0) | [docs](/dotnet/api/overview/azure/Search.Documents-readme) | GitHub [11.7.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.7.0/sdk/search/Azure.Search.Documents/) | @@ -116,8 +116,8 @@ | Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_1.0.0/sdk/translation/Azure.AI.Translation.Text/) | | Time Series Insights | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.IoT.TimeSeriesInsights/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/IoT.TimeSeriesInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.TimeSeriesInsights_1.0.0-beta.1/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/) | | TimeZone | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Maps.TimeZones/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Maps.TimeZones-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Maps.TimeZones_1.0.0-beta.1/sdk/maps/Azure.Maps.TimeZones/) | -| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.1/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | -| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.1/sdk/agentserver/Azure.AI.AgentServer.Core/) | +| unknown | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.2/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | +| unknown | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.2/sdk/agentserver/Azure.AI.AgentServer.Core/) | | Vision Common | NuGet [0.15.1-beta.1](https://www.nuget.org/packages/Azure.AI.Vision.Common/0.15.1-beta.1) | | GitHub [0.15.1-beta.1](https://msasg.visualstudio.com/Skyman/_git/Carbon) | | Voice Live | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.0.0) | [docs](/dotnet/api/overview/azure/AI.VoiceLive-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.0.0/sdk/ai/Azure.AI.VoiceLive/) | | WCF Storage Queues | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.WCF.Azure.StorageQueues/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.WCF.Azure.StorageQueues-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.WCF.Azure.StorageQueues_1.0.0-beta.1/sdk/extension-wcf/Microsoft.WCF.Azure.StorageQueues/) | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 46720ff7e9774..c550730d1c358 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -4,7 +4,7 @@ | AI Foundry | NuGet [1.1.0](https://www.nuget.org/packages/Azure.AI.Projects/1.1.0) | [docs](/dotnet/api/overview/azure/AI.Projects-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_1.1.0/sdk/ai/Azure.AI.Projects/) | | AI Model Inference | NuGet [1.0.0-beta.5](https://www.nuget.org/packages/Azure.AI.Inference/1.0.0-beta.5) | [docs](/dotnet/api/overview/azure/AI.Inference-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Inference_1.0.0-beta.5/sdk/ai/Azure.AI.Inference/) | | Anomaly Detector | NuGet [3.0.0-preview.7](https://www.nuget.org/packages/Azure.AI.AnomalyDetector/3.0.0-preview.7) | [docs](/dotnet/api/overview/azure/AI.AnomalyDetector-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [3.0.0-preview.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AnomalyDetector_3.0.0-preview.7/sdk/anomalydetector/Azure.AI.AnomalyDetector/) | -| App Configuration | NuGet [1.6.1](https://www.nuget.org/packages/Azure.Data.AppConfiguration/1.6.1) | [docs](/dotnet/api/overview/azure/Data.AppConfiguration-readme) | GitHub [1.6.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.AppConfiguration_1.6.1/sdk/appconfiguration/Azure.Data.AppConfiguration/) | +| App Configuration | NuGet [1.7.0](https://www.nuget.org/packages/Azure.Data.AppConfiguration/1.7.0) | [docs](/dotnet/api/overview/azure/Data.AppConfiguration-readme) | GitHub [1.7.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.AppConfiguration_1.7.0/sdk/appconfiguration/Azure.Data.AppConfiguration/) | | App Configuration Provider | NuGet [8.4.0](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.AzureAppConfiguration/8.4.0) | [docs](/dotnet/api/overview/azure/Microsoft.Extensions.Configuration.AzureAppConfiguration-readme) | GitHub [8.4.0](https://github.com/Azure/AppConfiguration-DotnetProvider) | | Attestation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Security.Attestation/1.0.0) | [docs](/dotnet/api/overview/azure/Security.Attestation-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.Attestation_1.0.0/sdk/attestation/Azure.Security.Attestation/) | | Azure AI Search | NuGet [11.7.0](https://www.nuget.org/packages/Azure.Search.Documents/11.7.0) | [docs](/dotnet/api/overview/azure/Search.Documents-readme) | GitHub [11.7.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.7.0/sdk/search/Azure.Search.Documents/) | @@ -124,8 +124,8 @@ | Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_1.0.0/sdk/translation/Azure.AI.Translation.Text/) | | Time Series Insights | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.IoT.TimeSeriesInsights/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/IoT.TimeSeriesInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.TimeSeriesInsights_1.0.0-beta.1/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/) | | TimeZone | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Maps.TimeZones/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Maps.TimeZones-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Maps.TimeZones_1.0.0-beta.1/sdk/maps/Azure.Maps.TimeZones/) | -| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.1/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | -| unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.1/sdk/agentserver/Azure.AI.AgentServer.Core/) | +| unknown | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.2/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | +| unknown | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.2/sdk/agentserver/Azure.AI.AgentServer.Core/) | | Video Analyzer Edge | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.Media.VideoAnalyzer.Edge/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Media.VideoAnalyzer.Edge-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Media.VideoAnalyzer.Edge_1.0.0-beta.6/sdk/videoanalyzer/Azure.Media.VideoAnalyzer.Edge/) | | Vision Common | NuGet [0.15.1-beta.1](https://www.nuget.org/packages/Azure.AI.Vision.Common/0.15.1-beta.1) | | GitHub [0.15.1-beta.1](https://msasg.visualstudio.com/Skyman/_git/Carbon) | | Voice Live | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.0.0) | [docs](/dotnet/api/overview/azure/AI.VoiceLive-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.0.0/sdk/ai/Azure.AI.VoiceLive/) | From b3f0558759feb5107e9cb76b3c110cfc6ba77143 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 11 Nov 2025 09:29:32 -0500 Subject: [PATCH 37/38] Add and consolidate errors and warnings for async and await (#49702) * Add existing error files Add existing diagnostics related to async and await. * Add missing errors and warnings Search the roslyn source for related error messages. Add them here. * rearrange sections * First edit pass * edit pass Edit and consolidate this article. * fix warning * respond to feedback. * Update docs/csharp/language-reference/compiler-messages/async-await-errors.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/prompts/error-consolidation.md | 4 +- .openpublishing.redirection.csharp.json | 40 ++++ .../compiler-messages/async-await-errors.md | 130 +++++++++++++ .../compiler-messages/cs1983.md | 47 ----- .../compiler-messages/cs1986.md | 83 --------- .../compiler-messages/cs1994.md | 51 ------ .../compiler-messages/cs1996.md | 58 ------ .../compiler-messages/cs1997.md | 47 ----- .../compiler-messages/cs4008.md | 57 ------ .../compiler-messages/cs4014.md | 173 ------------------ .../compiler-messages/cs4032.md | 49 ----- .../compiler-messages/cs4033.md | 48 ----- .../language-reference/keywords/async.md | 2 +- docs/csharp/language-reference/toc.yml | 25 +-- docs/csharp/misc/CS4009.md | 65 ------- ...n-t-have-specifics-on-this-csharp-error.md | 8 +- 16 files changed, 179 insertions(+), 708 deletions(-) create mode 100644 docs/csharp/language-reference/compiler-messages/async-await-errors.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs1983.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs1986.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs1994.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs1996.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs1997.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs4008.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs4014.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs4032.md delete mode 100644 docs/csharp/language-reference/compiler-messages/cs4033.md delete mode 100644 docs/csharp/misc/CS4009.md diff --git a/.github/prompts/error-consolidation.md b/.github/prompts/error-consolidation.md index 0b3244152a8f1..863202d303297 100644 --- a/.github/prompts/error-consolidation.md +++ b/.github/prompts/error-consolidation.md @@ -12,8 +12,8 @@ Overall steps: We're going to work through a series of files consolidating errors and warnings. -- For the duration of this chat, all references to "destination file" refer to `using-statement-declaration-errors.md. -- For the duration of this chat, all references to "the target theme" refer to errors and warnings related to `using` statements and `using` variable declarations. Note that the `using` keyword can also be used for a `using` directive. Don't include those error messages. +- For the duration of this chat, all references to "destination file" refer to `async-await-errors.md. +- For the duration of this chat, all references to "the target theme" refer to errors and warnings related to `async` function declarations and `await` expressions. The destination file already contains a skeleton for the final output. diff --git a/.openpublishing.redirection.csharp.json b/.openpublishing.redirection.csharp.json index b2e53879fc6d0..15f9328c66834 100644 --- a/.openpublishing.redirection.csharp.json +++ b/.openpublishing.redirection.csharp.json @@ -471,6 +471,26 @@ "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1946.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions" }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1983.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1986.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1994.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1996.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1997.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, { "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1988.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/ref-modifiers-errors" @@ -479,6 +499,26 @@ "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs4004.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/unsafe-code-errors" }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs4008.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs4014.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs4032.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs4033.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, + { + "source_path_from_root": "/docs/csharp/misc/CS4009.md", + "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/async-await-errors" + }, { "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs3007.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors" diff --git a/docs/csharp/language-reference/compiler-messages/async-await-errors.md b/docs/csharp/language-reference/compiler-messages/async-await-errors.md new file mode 100644 index 0000000000000..c9faed7a5abf1 --- /dev/null +++ b/docs/csharp/language-reference/compiler-messages/async-await-errors.md @@ -0,0 +1,130 @@ +--- +title: Resolve errors and warnings that involve `async`, `await` and the Task-asynchronous protocol +description: These compiler errors and warnings indicate errors in the syntax for declaring and implementing `async` methods that use the `await` expression. +f1_keywords: + - "CS1983" + - "CS1985" + - "CS1986" + - "CS1989" + - "CS1991" + - "CS1992" + - "CS1994" + - "CS1995" + - "CS1996" + - "CS1997" + - "CS1998" + - "CS4008" + - "CS4009" + - "CS4014" + - "CS4032" + - "CS4033" + - "CS8892" + - "CS9123" + - "CS9330" +helpviewer_keywords: + - "CS1983" + - "CS1985" + - "CS1986" + - "CS1989" + - "CS1991" + - "CS1992" + - "CS1994" + - "CS1995" + - "CS1996" + - "CS1997" + - "CS1998" + - "CS4008" + - "CS4009" + - "CS4014" + - "CS4032" + - "CS4033" + - "CS8892" + - "CS9123" + - "CS9330" +ms.date: 11/10/2025 +ai-usage: ai-assisted +--- +# Resolve errors and warnings in async methods using the await operator + +This article covers the following compiler errors: + + +- [**CS1983**](#async-method-signature-requirements): *Since this is an async method, the return expression must be of type '`Task`' rather than '`T`'.* +- [**CS1985**](#await-expression-requirements): *Cannot await in a catch clause.* +- [**CS1986**](#await-expression-requirements): *'`await`' requires that the type have a suitable '`GetAwaiter`' method.* +- [**CS1989**](#async-practices): *Async lambda expressions cannot be converted to expression trees.* +- [**CS1991**](#async-practices): *'Type' cannot implement 'event' because it is a Windows Runtime event and 'event' is a regular .NET event.* +- [**CS1992**](#await-expression-requirements): *The '`await`' operator can only be used when contained within a method or lambda expression marked with the 'async' modifier.* +- [**CS1994**](#async-method-signature-requirements): *The '`async`' modifier can only be used in methods that have a body.* +- [**CS1995**](#await-expression-requirements): *The '`await`' operator may only be used in a query expression within the first collection expression of the initial '`from`' clause or within the collection expression of a '`join`' clause.* +- [**CS1996**](#await-expression-requirements): *Cannot await in the body of a lock statement.* +- [**CS1997**](#async-practices): *Since function is an async method that returns a value, a return keyword must not be followed by an object expression.* +- [**CS1998**](#async-practices): *This async method lacks '`await`' operators and will run synchronously. Consider using the '`await`' operator to await non-blocking API calls, or '`await Task.Run(...)`' to do CPU-bound work on a background thread.* +- [**CS4008**](#await-expression-requirements): *Cannot await '`void`'.* +- [**CS4009**](#async-method-signature-requirements): *A void or int returning entry point cannot be async.* +- [**CS4014**](#async-practices): *Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the `await` operator to the result of the call.* +- [**CS4032**](#await-expression-requirements): *The '`await`' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to '`Task`'.* +- [**CS4033**](#await-expression-requirements): *The '`await`' operator can only be used within an async method. Consider marking this method with the '`async`' modifier and changing its return type to '`Task`'.* +- [**CS8892**](#async-method-signature-requirements): *Method will not be used as an entry point because a synchronous entry point was found.* +- [**CS9123**](#async-practices): *The '`&`' operator should not be used on parameters or local variables in async methods.* +- [**CS9330**](#async-method-signature-requirements): *'`MethodImplAttribute.Async`' cannot be manually applied to methods. Mark the method 'async'.* + +## Await expression requirements + +- **CS1985**: *Cannot await in a catch clause.* +- **CS1986**: *'`await`' requires that the type have a suitable '`GetAwaiter`' method.* +- **CS1992**: *The '`await`' operator can only be used when contained within a method or lambda expression marked with the '`async`' modifier.* +- **CS1995**: *The '`await`' operator may only be used in a query expression within the first collection expression of the initial '`from`' clause or within the collection expression of a '`join`' clause.* +- **CS1996**: *Cannot await in the body of a lock statement.* +- **CS4008**: *Cannot await '`void`'.* +- **CS4032**: *The '`await`' operator can only be used within an async method. Consider marking this method with the '`async`' modifier and changing its return type to '`Task`'.* +- **CS4033**: *The '`await`' operator can only be used within an async method. Consider marking this method with the '`async`' modifier and changing its return type to '`Task`'.* + +To use the `await` operator correctly, follow these rules. For more information, see [Asynchronous programming with async and await](../../asynchronous-programming/index.md). + +- Don't use `await` in catch clauses (**CS1985**). While you can use `await` in try blocks and finally blocks (in C# 6 and later), catch blocks present special challenges with exception handling and control flow. +- Don't use `await` inside [`lock` statement](../statements/lock.md) blocks (**CS1996**). The compiler doesn't support this to avoid emitting code prone to deadlocks. +- Use `await` only in specific locations within [query expressions](../keywords/query-keywords.md) (**CS1995**): within the first collection expression of the initial `from` clause, or within the collection expression of a `join` clause. +- Mark methods or lambda expressions with the `async` modifier before using `await` (**CS1992**, **CS4032**, **CS4033**). +- Ensure awaited types have an accessible `GetAwaiter` method that returns an awaiter type (**CS1986**). +- Don't apply `await` to expressions of type `void` (**CS4008**). +- Change the return type to `Task` for methods that don't return a value, or `Task` for methods that return a value. + +## Async method signature requirements + +- **CS1983**: *Since this is an async method, the return expression must be of type '`Task`' rather than '`T`'.* +- **CS1994**: *The '`async`' modifier can only be used in methods that have a body.* +- **CS4009**: *A void or int returning entry point cannot be async.* +- **CS8892**: *Method will not be used as an entry point because a synchronous entry point was found.* +- **CS9330**: *'`MethodImplAttribute.Async`' cannot be manually applied to methods. Mark the method '`async`'.* + +To declare async methods correctly, follow these signature requirements. For more information, see [Async main return values](../../fundamentals/program-structure/main-command-line.md#async-main-return-values). + +- Return one of the valid types: `void`, , `Task`, a task-like type, , or (**CS1983**). +- Use the `async` modifier only on methods with a body (**CS1994**). Remove the `async` modifier on abstract methods in interfaces or classes. +- Update to C# 7.1 or higher to use `async` on the `Main` entry point, or avoid using `async` on entry points in earlier versions (**CS4009**). +- Remove synchronous entry points if you have both sync and async entry points (**CS8892**). +- Use the `async` keyword instead of manually applying `MethodImplAttribute.Async` (**CS9330**). + +## Async practices + +- **CS1989**: *Async lambda expressions cannot be converted to expression trees.* +- **CS1991**: *'Type' cannot implement 'event' because it is a Windows Runtime event and 'event' is a regular .NET event.* +- **CS1997**: *Since function is an async method that returns a value, a return keyword must not be followed by an object expression.* +- **CS1998**: *This async method lacks '`await`' operators and will run synchronously. Consider using the '`await`' operator to await non-blocking API calls, or '`await Task.Run(...)`' to do CPU-bound work on a background thread.* +- **CS4014**: *Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the `await` operator to the result of the call.* +- **CS9123**: *The '`&`' operator should not be used on parameters or local variables in async methods.* + +To write async code correctly and avoid common pitfalls, follow these best practices. For more information, see [Asynchronous programming with async and await](../../asynchronous-programming/index.md). + +- Always [await](../operators/await.md) calls to async methods that return or (**CS4014**). Unawaited calls can lead to lost exceptions and unexpected behavior. +- Don't return a value from async methods that return `Task` (non-generic); use `Task` instead (**CS1997**). +- Include at least one `await` operator in async methods, or remove the `async` modifier (**CS1998**). +- Remove the `return` statement if the method should return `Task` (**CS1997**, **CS1998**). +- Change the method's return type to `Task` to return a value (**CS1997**, **CS1998**). +- Remove the `async` modifier and return the task directly if you don't need the async state machine (**CS1997**, **CS1998**). +- Don't use async methods in expression trees (**CS1989**). Expression trees represent code as data and don't support the complex state machine transformations required by async methods. +- Don't mark add or remove accessors in an interface or WinRT event as async (**CS1991**). This is a platform-specific restriction for Windows Runtime interoperability. +- Avoid using the address-of operator (`&`) on expressions inside async methods (**CS9123**). The target may be relocated in memory during suspension, making the pointer invalid. diff --git a/docs/csharp/language-reference/compiler-messages/cs1983.md b/docs/csharp/language-reference/compiler-messages/cs1983.md deleted file mode 100644 index 9d1e51b718f44..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs1983.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -description: "Compiler Error CS1983" -title: "Compiler Error CS1983" -ms.date: 9/12/2022 -f1_keywords: - - "CS1983" -helpviewer_keywords: - - "CS1983" ---- -# Compiler Error CS1983 - -The return type of an async method must be void, Task, Task\, a task-like type (A task-like type is one that adheres to the pattern, [described here](~/_csharpstandard/standard/classes.md#15151-general), required by the C# specification), IAsyncEnumerable\, or IAsyncEnumerator\ - -## Example - - The following sample generates CS1983: - -```csharp -// CS1983.cs (4,62) -using System.Collections.Generic; - -class C -{ - static async IEnumerable M() - { - yield return await Task.FromResult(1); - } -} -``` - -Since `IEnumerable.GetEnumerator` returns an `IEnumerator` whose `MoveNext` method does not return a value of `Task`, it is not compatible with an `async` method. - -## To correct this error - -Use an interface that results in the invocation of method that returns a type of `Task`, for example, `IAsyncEnumerable`: - -```csharp -using System.Collections.Generic; - -class C -{ - static async IAsyncEnumerable M() - { - yield return await Task.FromResult(1); - } -} -``` diff --git a/docs/csharp/language-reference/compiler-messages/cs1986.md b/docs/csharp/language-reference/compiler-messages/cs1986.md deleted file mode 100644 index ba1290a505728..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs1986.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -description: "Compiler Error CS1986" -title: "Compiler Error CS1986" -ms.date: 9/12/2022 -f1_keywords: - - "CS1986" -helpviewer_keywords: - - "CS1986" ---- -# Compiler Error CS1986 - -'await' requires that the type have a suitable 'GetAwaiter' method - -## Example - - The following sample generates CS1986: - -```csharp -using System.Runtime.CompilerServices; -using System; -using System.Threading.Tasks; - -class Program -{ - static async Task M(MyTask x) - { - var z = await x; - System.Console.WriteLine(z); - } -} - -public class MyTask -{ - readonly MyTaskAwaiter awaiter; - public MyTask(TResult value) - { - this.awaiter = new MyTaskAwaiter(value); - } - public static MyTaskAwaiter GetAwaiter() => throw new NotImplementedException(); -} - -public class MyTaskAwaiter : INotifyCompletion -{ - TResult value; - public MyTaskAwaiter(TResult value) - { - this.value = value; - } - public bool IsCompleted { get => true; } - public TResult GetResult() => value; - public void OnCompleted(Action continuation) => throw new NotImplementedException(); -} -``` - -A `GetAwaiter` method must be a non-static method named `GetAwaiter` and return an instance of an object that implements `INotifyCompletion`. - -A GetAwaiter needs to implement the `INotifyCompletion` interface (and optionally the `ICriticalNotifyCompletion` interface) and return a type that itself exposes three members [1]: - -```csharp -bool IsCompleted { get; } -void OnCompleted(Action continuation); -TResult GetResult(); // TResult can also be void -``` - -## To correct this error - -The reason CS1986 is raised in the example is that the `GetAwaiter` method is `static`. To correct this error, remove the `static` modifier (and correctly implement the method): - -```csharp -public class MyTask -{ - readonly MyTaskAwaiter awaiter; - public MyTask(TResult value) - { - this.awaiter = new MyTaskAwaiter(value); - } - public MyTaskAwaiter GetAwaiter() => awaiter; -} -``` - -## See also - -[1] [await anything;](https://devblogs.microsoft.com/pfxteam/await-anything/) diff --git a/docs/csharp/language-reference/compiler-messages/cs1994.md b/docs/csharp/language-reference/compiler-messages/cs1994.md deleted file mode 100644 index a6c89cc814384..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs1994.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -description: "Compiler Error CS1994" -title: "Compiler Error CS1994" -ms.date: 9/12/2022 -f1_keywords: - - "CS1994" -helpviewer_keywords: - - "CS1994" ---- -# Compiler Error CS1994 - -The 'async' modifier can only be used in methods that have a body. - -## Example - - The following sample generates CS1994: - -```csharp -interface IInterface -{ - async void F(); -} -``` - -## To correct this error - -A non-concrete method declaration in an interface declaration has no method body. In order to support the `async` modifier, the compiler subsumes the method body logic in a state machine. Without a method body, the compiler cannot emit this state machine. In addition, the logic of a method body must contain an await operator to signify a continuation the state machine must manage. Without that `await` operator, a state machine has nothing to manage. - -In the case of a non-concrete method, if deferring the implementation of a method body to a class that implements the interface, simply removing the async modifier will correct the error: - -```csharp -interface IInterface -{ - void F(); -} -``` - -Alternatively, a concrete default method (introduced in C# 8.0) could be declared within the interface: - -```csharp -interface IInterface -{ - async void F() - { - await Task.Run(() => - { - /* do something useful*/ - }); - } -} -``` diff --git a/docs/csharp/language-reference/compiler-messages/cs1996.md b/docs/csharp/language-reference/compiler-messages/cs1996.md deleted file mode 100644 index 8d9b75aae1616..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs1996.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -description: "Compiler Error CS1996" -title: "Compiler Error CS1996" -ms.date: 7/01/2024 -f1_keywords: - - "CS1996" -helpviewer_keywords: - - "CS1996" ---- -# Compiler Error CS1996 - -Cannot await in the body of a lock statement - -## Example - -The following sample generates CS1996: - -```csharp -public class C -{ - private readonly Dictionary keyValuePairs = new(); - - public async Task ReplaceValueAsync(string key, HttpClient httpClient) - { - lock (keyValuePairs) - { - var newValue = await httpClient.GetStringAsync(string.Empty); - if (keyValuePairs.ContainsKey(key)) keyValuePairs[key] = newValue; - else keyValuePairs.Add(key, newValue); - return newValue; - } - } -} -``` - -The preceding code produces the same error with C# 13, as the `await` is in the `lock` statement block. - -## To correct this error - -Asynchronous code within a `lock` statement block is hard to implement reliably and even harder to implement in a general sense. The C# compiler doesn't support doing this to avoid emitting code prone to deadlocks. Extracting the asynchronous code from the `lock` statement block corrects this error. For example: - -```csharp -public class C -{ - private readonly Dictionary keyValuePairs = new(); - - public async Task ReplaceValueAsync(string key, HttpClient httpClient) - { - var newValue = await httpClient.GetStringAsync(string.Empty); - lock (keyValuePairs) - { - if (keyValuePairs.ContainsKey(key)) keyValuePairs[key] = newValue; - else keyValuePairs.Add(key, newValue); - return newValue; - } - } -} -``` diff --git a/docs/csharp/language-reference/compiler-messages/cs1997.md b/docs/csharp/language-reference/compiler-messages/cs1997.md deleted file mode 100644 index d5adabf0a174c..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs1997.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -description: "Compiler Error CS1997" -title: "Compiler Error CS1997" -ms.date: 9/12/2022 -f1_keywords: - - "CS1997" -helpviewer_keywords: - - "CS1997" ---- -# Compiler Error CS1997 - -Since `method` is an async method that returns `Task`, a return keyword must not be followed by an object expression. Did you intend to return `Task`? - -## Example - - The following sample generates CS1997: - -```csharp -using System.Threading.Tasks; -class C -{ - public static async Task F1() - { - return await Task.Factory.StartNew(() => 1); - } -} -``` - -## To correct this error - -A `return` statement in an `async` method returns the result of an awaitable statement. If the awaitable statement does not have a result, the state machine emitted by the compiler encapsulates returning the non-generic `Task`, eliminating the need for a `return` statement. Encountering error CS1997 means the referenced code includes a `return` statement that conflicts with the `async` modifier and the method's `return` type. The error indicates that the current method's implementation does not align with its initial intent. The simplest way to correct the error is to remove the `return` statement: - -```csharp - public static async Task F1() - { - await Task.Factory.StartNew(() => 1); - } -``` - -But, the resulting implementation no longer needs the `async` modifier or the `await` operator. A more accurate way of correcting this error is not to remove the `return` statement, but to remove the `async` modifier and the `await` operator: - -```csharp - public static Task F1() - { - return Task.Factory.StartNew(() => 1); - } -``` diff --git a/docs/csharp/language-reference/compiler-messages/cs4008.md b/docs/csharp/language-reference/compiler-messages/cs4008.md deleted file mode 100644 index 67f5f1fd24daa..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs4008.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -description: "Compiler Error CS4008" -title: "Compiler Error CS4008" -ms.date: 9/12/2022 -f1_keywords: - - "CS4008" -helpviewer_keywords: - - "CS4008" ---- -# Compiler Error CS4008 - -Cannot await 'void' - -## Example - - The following sample generates CS4008: - -```csharp -// CS4008.cs (7,33) - -using System.Threading.Tasks; - -class Test -{ - public async void goo() - { - await Task.Factory.StartNew(() => { }); - } - - public async void bar() - { - await goo(); - } - - public static void Main() { } -} -``` - -## To correct this error - -Although this error can be corrected by changing the signature of `goo`: - -```csharp - public async Task goo() - { - await Task.Factory.StartNew(() => { }); - } -``` - -Simply adding `Task` to the method's signature needlessly perpetuates a compiler-created state machine when it is not needed. The `goo` method does not require an `await`, nor does it need to be asynchronous. Instead, consider simply returning the `Task` created by `Task.Factory`: - -```csharp - public Task goo() - { - return Task.Factory.StartNew(() => { }); - } -``` diff --git a/docs/csharp/language-reference/compiler-messages/cs4014.md b/docs/csharp/language-reference/compiler-messages/cs4014.md deleted file mode 100644 index 4279ed95e5c76..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs4014.md +++ /dev/null @@ -1,173 +0,0 @@ ---- -description: "Compiler Warning (level 1) CS4014" -title: "Compiler Warning (level 1) CS4014" -ms.date: 08/18/2020 -f1_keywords: - - "CS4014" -helpviewer_keywords: - - "CS4014" -ms.assetid: b9e7c029-eaa9-48d7-8b3c-9823772c9acb ---- - -# Compiler Warning (level 1) CS4014 - -Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the `await` operator to the result of the call. - -The current method calls an async method that returns a or a and doesn't apply the [await](../operators/await.md) operator to the result. The call to the async method starts an asynchronous task. However, because no `await` operator is applied, the program continues without waiting for the task to complete. In most cases, that behavior isn't what you expect. Usually other aspects of the calling method depend on the results of the call or, minimally, the called method is expected to complete before you return from the method that contains the call. - -An equally important issue is what happens to exceptions that are raised in the called async method. An exception that's raised in a method that returns a or is stored in the returned task. If you don't await the task or explicitly check for exceptions, the exception is lost. If you await the task, its exception is rethrown. - -As a best practice, you should always await the call. - -You should consider suppressing the warning only if you're sure that you don't want to wait for the asynchronous call to complete and that the called method won't raise any exceptions. In that case, you can suppress the warning by assigning the task result of the call to a variable. - -The following example shows how to cause the warning, how to suppress it, and how to await the call. - -```csharp -static async Task CallingMethodAsync(int millisecondsDelay) -{ - Console.WriteLine(" Entering calling method."); - - // Call #1. - // Call an async method. Because you don't await it, its completion - // isn't coordinated with the current method, CallingMethodAsync. - // The following line causes warning CS4014. - CalledMethodAsync(millisecondsDelay); - - // Call #2. - // To suppress the warning without awaiting, you can assign the - // returned task to a variable. The assignment doesn't change how - // the program runs. However, recommended practice is always to - // await a call to an async method. - - // Replace Call #1 with the following line. - // Task delayTask = CalledMethodAsync(millisecondsDelay); - - // Call #3 - // To contrast with an awaited call, replace the unawaited call - // (Call #1 or Call #2) with the following awaited call. Best - // practice is to await the call. - - // await CalledMethodAsync(millisecondsDelay); - - Console.WriteLine(" Returning from calling method."); -} - -static async Task CalledMethodAsync(int millisecondsDelay) -{ - Console.WriteLine(" Entering called method, starting and awaiting Task.Delay."); - - await Task.Delay(millisecondsDelay); - - Console.WriteLine(" Task.Delay is finished--returning from called method."); -} -``` - -In the example, if you choose Call #1 or Call #2, the unawaited async method `CalledMethodAsync` finishes after both its caller `CallingMethodAsync` and the caller's caller is complete. The last line in the following output shows you when the called method finishes. Entry to and exit from the event handler that calls `CallingMethodAsync` in the full example are marked in the output. - -```console -Entering the Click event handler. - Entering calling method. - Entering called method, starting and awaiting Task.Delay. - Returning from calling method. -Exiting the Click event handler. - Task.Delay is finished--returning from called method. -``` - -You can also suppress compiler warnings by using [#pragma warning](../preprocessor-directives.md#pragma-warning) directives. - -## Example - -The following console application contains the methods from the previous example. The following steps set up the application. - -1. Create a console application, and name it `AsyncWarning`. -1. In the Visual Studio Code Editor, choose the *Program.cs* file. -1. Replace the code in *Program.cs* with the following code. - - ```csharp - using System; - using System.Threading.Tasks; - - namespace AsyncWarning - { - class Program - { - static async Task Main() - { - Console.WriteLine("Entering Main() application entry point."); - - int millisecondsDelay = 2000; - await CallingMethodAsync(millisecondsDelay); - - Console.WriteLine("Exiting Main() application entry point."); - - await Task.Delay(millisecondsDelay + 500); - } - - static async Task CallingMethodAsync(int millisecondsDelay) - { - Console.WriteLine(" Entering calling method."); - - // Call #1. - // Call an async method. Because you don't await it, its completion - // isn't coordinated with the current method, CallingMethodAsync. - // The following line causes warning CS4014. - // CalledMethodAsync(millisecondsDelay); - - // Call #2. - // To suppress the warning without awaiting, you can assign the - // returned task to a variable. The assignment doesn't change how - // the program runs. However, recommended practice is always to - // await a call to an async method. - - // Replace Call #1 with the following line. - //Task delayTask = CalledMethodAsync(millisecondsDelay); - - // Call #3 - // To contrast with an awaited call, replace the unawaited call - // (Call #1 or Call #2) with the following awaited call. Best - // practice is to await the call. - - // await CalledMethodAsync(millisecondsDelay); - - Console.WriteLine(" Returning from calling method."); - } - - static async Task CalledMethodAsync(int millisecondsDelay) - { - Console.WriteLine(" Entering called method, starting and awaiting Task.Delay."); - - await Task.Delay(millisecondsDelay); - - Console.WriteLine(" Task.Delay is finished--returning from called method."); - } - } - - // Output with Call #1 or Call #2. (Wait for the last line to appear.) - - // Entering Main() application entry point. - // Entering calling method. - // Entering called method, starting and awaiting Task.Delay. - // Returning from calling method. - // Exiting Main() application entry point. - // Task.Delay is finished--returning from called method. - - // Output with Call #3, which awaits the call to CalledMethodAsync. - - // Entering Main() application entry point. - // Entering calling method. - // Entering called method, starting and awaiting Task.Delay. - // Task.Delay is finished--returning from called method. - // Returning from calling method. - // Exiting Main() application entry point. - } - ``` - -1. Select the F5 key to run the program. - -The expected output appears at the end of the code. - -## See also - -- [await](../operators/await.md) -- [Asynchronous programming with async and await](../../asynchronous-programming/index.md) diff --git a/docs/csharp/language-reference/compiler-messages/cs4032.md b/docs/csharp/language-reference/compiler-messages/cs4032.md deleted file mode 100644 index a1cfdc2217b95..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs4032.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -description: "Compiler Error CS4032" -title: "Compiler Error CS4032" -ms.date: 9/12/2022 -f1_keywords: - - "CS4032" -helpviewer_keywords: - - "CS4032" ---- -# Compiler Error CS4032 - -The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task\'. - -## Example - - The following sample generates CS4032: - -```csharp -// CS4032.cs (7,9) -using System.Collections.Generic; -using System.Threading.Tasks; - -class C -{ - static IAsyncEnumerator M(int value) - { - yield return value; - await Task.CompletedTask; - } -} -``` - -## To correct this error - -To correct this error, change the signature of method `M` to make it asynchronous: - -```csharp -using System.Collections.Generic; -using System.Threading.Tasks; - -class C -{ - static async IAsyncEnumerator M(int value) - { - yield return value; - await Task.CompletedTask; - } -} -``` diff --git a/docs/csharp/language-reference/compiler-messages/cs4033.md b/docs/csharp/language-reference/compiler-messages/cs4033.md deleted file mode 100644 index d9c3ca232acb1..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs4033.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -description: "Compiler Error CS4033" -title: "Compiler Error CS4033" -ms.date: 9/12/2022 -f1_keywords: - - "CS4033" -helpviewer_keywords: - - "CS4033" ---- -# Compiler Error CS4033 - -The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. - -## Example - - The following sample generates CS4033: - -```csharp -// CS4033.cs (7,9) - -using System.Collections.Generic; -class C -{ - void M(IAsyncEnumerable collection) - { - await foreach (var i in collection) - { - } - } -} -``` - -## To correct this error - -To correct this error, change the signature of method `M` to make it asynchronous: - -```csharp -using System.Collections.Generic; -class C -{ - async void M(IAsyncEnumerable collection) - { - await foreach (var i in collection) - { - } - } -} -``` diff --git a/docs/csharp/language-reference/keywords/async.md b/docs/csharp/language-reference/keywords/async.md index 2562d0ecb113d..a65193cbd47ca 100644 --- a/docs/csharp/language-reference/keywords/async.md +++ b/docs/csharp/language-reference/keywords/async.md @@ -30,7 +30,7 @@ string contents = await httpClient.GetStringAsync(requestUrl); An async method runs synchronously until it reaches its first `await` expression, at which point the method is suspended until the awaited task is complete. In the meantime, control returns to the caller of the method, as the example in the next section shows. -If the method that the `async` keyword modifies doesn't contain an `await` expression or statement, the method executes synchronously. A compiler warning alerts you to any async methods that don't contain `await` statements, because that situation might indicate an error. See [Compiler Warning (level 1) CS4014](../compiler-messages/cs4014.md). +If the method that the `async` keyword modifies doesn't contain an `await` expression or statement, the method executes synchronously. A compiler warning alerts you to any async methods that don't contain `await` statements, because that situation might indicate an error. See [Compiler Warning (level 1) CS4014](../compiler-messages/async-await-errors.md#async-practices). The `async` keyword is contextual in that it's a keyword only when it modifies a method, a lambda expression, or an anonymous method. In all other contexts, it's interpreted as an identifier. diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml index ccba45bd2a50e..081e8b3c26050 100644 --- a/docs/csharp/language-reference/toc.yml +++ b/docs/csharp/language-reference/toc.yml @@ -503,6 +503,11 @@ items: CS0182, CS0591, CS0599, CS0617, CS0633, CS0643, CS0655, CS0839, CS1016, CS1739, CS1740, CS1742, CS1744, CS1746, CS7036, CS7067, CS8196, CS8324, CS8861, CS8905, CS8943, CS8944, CS8945, CS8948, CS8949, CS8950, CS8951, CS8964, CS8965, CS8966 + - name: asynchronous methods + href: ./compiler-messages/async-await-errors.md + displayName: > + async, await, + CS1983, CS1985, CS1986, CS1989, CS1991, CS1992, CS1994, CS1995, CS1996, CS1997, CS1998, CS4008, CS4009, CS4014, CS4032, CS4033, CS8892, CS9123, CS9330 - name: Reference parameters href: ./compiler-messages/ref-modifiers-errors.md displayName: > @@ -1734,16 +1739,6 @@ items: href: ../misc/cs1958.md - name: CS1959 href: ../misc/cs1959.md - - name: CS1983 - href: ./compiler-messages/cs1983.md - - name: CS1986 - href: ./compiler-messages/cs1986.md - - name: CS1994 - href: ./compiler-messages/cs1994.md - - name: CS1996 - href: ./compiler-messages/cs1996.md - - name: CS1997 - href: ./compiler-messages/cs1997.md - name: CS2001 href: ../misc/cs2001.md - name: CS2003 @@ -1790,14 +1785,6 @@ items: href: ../misc/cs2035.md - name: CS2036 href: ../misc/cs2036.md - - name: CS4008 - href: ./compiler-messages/cs4008.md - - name: CS4009 - href: ../misc/CS4009.md - - name: CS4032 - href: ./compiler-messages/cs4032.md - - name: CS4033 - href: ./compiler-messages/cs4033.md - name: CS5001 href: ../misc/cs5001.md - name: CS7003 @@ -2048,8 +2035,6 @@ items: href: ../misc/cs3026.md - name: CS3027 href: ../misc/cs3027.md - - name: CS4014 - href: ./compiler-messages/cs4014.md - name: CS5000 href: ../misc/cs5000.md - name: Level 2 warning messages diff --git a/docs/csharp/misc/CS4009.md b/docs/csharp/misc/CS4009.md deleted file mode 100644 index 5649a7cf26184..0000000000000 --- a/docs/csharp/misc/CS4009.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -description: "Learn more about: Compiler Error CS4009" -title: "Compiler Error CS4009" -ms.date: 08/25/2018 -f1_keywords: - - "CS4009" -helpviewer_keywords: - - "CS4009" ---- -# Compiler Error CS4009 - -'Type.Method': an entry point cannot be marked with the `async` modifier. - -You cannot use the `async` keyword in the application entry point (typically the `Main` method). - -> [!IMPORTANT] -> Starting with C# 7.1, the `Main` method can have an `async` modifier. For more information, see [Async main return values](../fundamentals/program-structure/main-command-line.md#async-main-return-values). For information about how to select the C# language version, see the [Select the C# language version](../language-reference/configure-language-version.md) article. - -## Example - -The following example produces CS4009: - -```csharp -using System; -using System.Threading.Tasks; - -public class Example -{ - public static async void Main() - { - Console.WriteLine("About to wait two seconds"); - await WaitTwoSeconds(); - Console.WriteLine("About to exit the program"); - } - - private static async Task WaitTwoSeconds() - { - await Task.Delay(2000); - Console.WriteLine("Returning from an asynchronous method"); - } -} -``` - -## To correct this error - -[Update the C# language version](../language-reference/configure-language-version.md) used by the project to 7.1 or higher. - -If you use C# 7.0 or lower, remove the `async` keyword from the signature of the application entry point. Also remove any `await` keywords you've used to await asynchronous methods in your application entry point. - -However, you still have to wait for the asynchronous method to complete before your entry point resumes execution. Otherwise, compilation generates compiler warning CS4014, and the application will terminate before the asynchronous operation completes. The following example illustrates this problem: - -[!code-csharp[CS4009](~/samples/snippets/csharp/misc/cs4009-1.cs)] - -To await a method that returns a , call its method, as the following example illustrates: - -[!code-csharp[CS4009](~/samples/snippets/csharp/misc/cs4009-2.cs)] - -To await a method that returns a , retrieve the value of its property, as the following example does: - -[!code-csharp[CS4009](~/samples/snippets/csharp/misc/cs4009-3.cs)] - -## See also - -- [`async` keyword](../language-reference/keywords/async.md) -- [`await` operator](../language-reference/operators/await.md) diff --git a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md index 9fe1611f0a880..bc74762b1800a 100644 --- a/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md +++ b/docs/csharp/misc/sorry-we-don-t-have-specifics-on-this-csharp-error.md @@ -39,14 +39,8 @@ f1_keywords: - "CS1960" - "CS1961" - "CS1982" - - "CS1985" - - "CS1989" - - "CS1991" - - "CS1992" - - "CS1995" - "CS1996" - "CS1997" - - "CS1998" - "CS2038" - "CS2039" - "CS2040" @@ -548,7 +542,7 @@ f1_keywords: - "CS9096" - "CS9097" # C# 14 errors begin here - - "CS9330" + - "CS9331" - "CS9333" - "CS9334" From 4817bad84bdd49e0c8967756de1a5847503bbf86 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 11 Nov 2025 08:44:53 -0800 Subject: [PATCH 38/38] Update package index with latest published versions (#49711) --- docs/azure/includes/dotnet-all.md | 9 +++++---- docs/azure/includes/dotnet-new.md | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 6953b8ae29820..2db33027bea89 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -84,7 +84,7 @@ | Playwright | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Developer.Playwright/1.0.0) | [docs](/dotnet/api/overview/azure/Developer.Playwright-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Developer.Playwright_1.0.0/sdk/loadtestservice/Azure.Developer.Playwright/) | | Playwright NUnit | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Developer.Playwright.NUnit/1.0.0) | [docs](/dotnet/api/overview/azure/Developer.Playwright.NUnit-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Developer.Playwright.NUnit_1.0.0/sdk/loadtestservice/Azure.Developer.Playwright.NUnit/) | | Programmable Connectivity | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Communication.ProgrammableConnectivity/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.ProgrammableConnectivity-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.ProgrammableConnectivity_1.0.0-beta.1/sdk/communication/Azure.Communication.ProgrammableConnectivity/) | -| Provisioning | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Provisioning/1.3.0)
NuGet [1.4.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning/1.4.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning_1.3.0/sdk/provisioning/Azure.Provisioning/)
GitHub [1.4.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning_1.4.0-beta.1/sdk/provisioning/Azure.Provisioning/) | +| Provisioning | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Provisioning/1.3.0)
NuGet [1.4.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning/1.4.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning_1.3.0/sdk/provisioning/Azure.Provisioning/)
GitHub [1.4.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning_1.4.0-beta.2/sdk/provisioning/Azure.Provisioning/) | | Provisioning - Resources | NuGet [0.2.0](https://www.nuget.org/packages/Azure.Provisioning.Resources/0.2.0) | [docs](/dotnet/api/overview/azure/Provisioning.Resources-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [0.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Resources_0.2.0/sdk/provisioning/Azure.Provisioning.Resources/) | | Purview Account | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.Purview.Account/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Analytics.Purview.Account-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Purview.Account_1.0.0-beta.1/sdk/purview/Azure.Analytics.Purview.Account/) | | Purview Administration | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.Purview.Administration/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Analytics.Purview.Administration-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Purview.Administration_1.0.0-beta.1/sdk/purview/Azure.Analytics.Purview.Administration/) | @@ -116,8 +116,9 @@ | Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_1.0.0/sdk/translation/Azure.AI.Translation.Text/) | | Time Series Insights | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.IoT.TimeSeriesInsights/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/IoT.TimeSeriesInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.TimeSeriesInsights_1.0.0-beta.1/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/) | | TimeZone | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Maps.TimeZones/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Maps.TimeZones-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Maps.TimeZones_1.0.0-beta.1/sdk/maps/Azure.Maps.TimeZones/) | -| unknown | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.2/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | -| unknown | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.2/sdk/agentserver/Azure.AI.AgentServer.Core/) | +| unknown | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.AI.AgentServer.AgentFramework/1.0.0-beta.3) | | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.AgentFramework_1.0.0-beta.3/sdk/agentserver/Azure.AI.AgentServer.AgentFramework/) | +| unknown | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.3) | | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.3/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | +| unknown | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.3) | | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.3/sdk/agentserver/Azure.AI.AgentServer.Core/) | | Vision Common | NuGet [0.15.1-beta.1](https://www.nuget.org/packages/Azure.AI.Vision.Common/0.15.1-beta.1) | | GitHub [0.15.1-beta.1](https://msasg.visualstudio.com/Skyman/_git/Carbon) | | Voice Live | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.0.0) | [docs](/dotnet/api/overview/azure/AI.VoiceLive-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.0.0/sdk/ai/Azure.AI.VoiceLive/) | | WCF Storage Queues | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.WCF.Azure.StorageQueues/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Microsoft.WCF.Azure.StorageQueues-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.WCF.Azure.StorageQueues_1.0.0-beta.1/sdk/extension-wcf/Microsoft.WCF.Azure.StorageQueues/) | @@ -247,7 +248,7 @@ | Resource Management - Digital Twins | NuGet [1.3.1](https://www.nuget.org/packages/Azure.ResourceManager.DigitalTwins/1.3.1) | [docs](/dotnet/api/overview/azure/ResourceManager.DigitalTwins-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DigitalTwins_1.3.1/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/) | | Resource Management - Disconnectedoperations | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.DisconnectedOperations/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.DisconnectedOperations-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DisconnectedOperations_1.0.0-beta.1/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/) | | Resource Management - DNS | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.Dns/1.1.1)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.Dns/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.Dns-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dns_1.1.1/sdk/dns/Azure.ResourceManager.Dns/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dns_1.2.0-beta.2/sdk/dns/Azure.ResourceManager.Dns/) | -| Resource Management - DNS Resolver | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.DnsResolver/1.2.0) | [docs](/dotnet/api/overview/azure/ResourceManager.DnsResolver-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DnsResolver_1.2.0/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/) | +| Resource Management - DNS Resolver | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.DnsResolver/1.2.0)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.DnsResolver/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.DnsResolver-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DnsResolver_1.2.0/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DnsResolver_1.3.0-beta.1/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/) | | Resource Management - Durabletask | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.DurableTask/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.DurableTask-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DurableTask_1.0.0/sdk/durabletask/Azure.ResourceManager.DurableTask/) | | Resource Management - Dynatrace | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.Dynatrace/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Dynatrace-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dynatrace_1.1.1/sdk/dynatrace/Azure.ResourceManager.Dynatrace/) | | Resource Management - Edge Order | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.EdgeOrder/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EdgeOrder-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EdgeOrder_1.1.1/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/) | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index c550730d1c358..a516592ec58f2 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -90,7 +90,7 @@ | Playwright | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Developer.Playwright/1.0.0) | [docs](/dotnet/api/overview/azure/Developer.Playwright-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Developer.Playwright_1.0.0/sdk/loadtestservice/Azure.Developer.Playwright/) | | Playwright NUnit | NuGet [1.0.0](https://www.nuget.org/packages/Azure.Developer.Playwright.NUnit/1.0.0) | [docs](/dotnet/api/overview/azure/Developer.Playwright.NUnit-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Developer.Playwright.NUnit_1.0.0/sdk/loadtestservice/Azure.Developer.Playwright.NUnit/) | | Programmable Connectivity | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Communication.ProgrammableConnectivity/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Communication.ProgrammableConnectivity-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.ProgrammableConnectivity_1.0.0-beta.1/sdk/communication/Azure.Communication.ProgrammableConnectivity/) | -| Provisioning | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Provisioning/1.3.0)
NuGet [1.4.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning/1.4.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning_1.3.0/sdk/provisioning/Azure.Provisioning/)
GitHub [1.4.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning_1.4.0-beta.1/sdk/provisioning/Azure.Provisioning/) | +| Provisioning | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Provisioning/1.3.0)
NuGet [1.4.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning/1.4.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning_1.3.0/sdk/provisioning/Azure.Provisioning/)
GitHub [1.4.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning_1.4.0-beta.2/sdk/provisioning/Azure.Provisioning/) | | Provisioning - Resources | NuGet [0.2.0](https://www.nuget.org/packages/Azure.Provisioning.Resources/0.2.0) | [docs](/dotnet/api/overview/azure/Provisioning.Resources-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [0.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Resources_0.2.0/sdk/provisioning/Azure.Provisioning.Resources/) | | Purview Account | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.Purview.Account/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Analytics.Purview.Account-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Purview.Account_1.0.0-beta.1/sdk/purview/Azure.Analytics.Purview.Account/) | | Purview Administration | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.Purview.Administration/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Analytics.Purview.Administration-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Purview.Administration_1.0.0-beta.1/sdk/purview/Azure.Analytics.Purview.Administration/) | @@ -124,8 +124,9 @@ | Text Translation | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.Translation.Text/1.0.0) | [docs](/dotnet/api/overview/azure/AI.Translation.Text-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Text_1.0.0/sdk/translation/Azure.AI.Translation.Text/) | | Time Series Insights | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.IoT.TimeSeriesInsights/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/IoT.TimeSeriesInsights-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.TimeSeriesInsights_1.0.0-beta.1/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/) | | TimeZone | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Maps.TimeZones/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Maps.TimeZones-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Maps.TimeZones_1.0.0-beta.1/sdk/maps/Azure.Maps.TimeZones/) | -| unknown | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.2/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | -| unknown | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.2/sdk/agentserver/Azure.AI.AgentServer.Core/) | +| unknown | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.AI.AgentServer.AgentFramework/1.0.0-beta.3) | | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.AgentFramework_1.0.0-beta.3/sdk/agentserver/Azure.AI.AgentServer.AgentFramework/) | +| unknown | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.AI.AgentServer.Contracts/1.0.0-beta.3) | | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Contracts_1.0.0-beta.3/sdk/agentserver/Azure.AI.AgentServer.Contracts/) | +| unknown | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.AI.AgentServer.Core/1.0.0-beta.3) | | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AgentServer.Core_1.0.0-beta.3/sdk/agentserver/Azure.AI.AgentServer.Core/) | | Video Analyzer Edge | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.Media.VideoAnalyzer.Edge/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Media.VideoAnalyzer.Edge-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Media.VideoAnalyzer.Edge_1.0.0-beta.6/sdk/videoanalyzer/Azure.Media.VideoAnalyzer.Edge/) | | Vision Common | NuGet [0.15.1-beta.1](https://www.nuget.org/packages/Azure.AI.Vision.Common/0.15.1-beta.1) | | GitHub [0.15.1-beta.1](https://msasg.visualstudio.com/Skyman/_git/Carbon) | | Voice Live | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.VoiceLive/1.0.0) | [docs](/dotnet/api/overview/azure/AI.VoiceLive-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.VoiceLive_1.0.0/sdk/ai/Azure.AI.VoiceLive/) | @@ -258,7 +259,7 @@ | Resource Management - Digital Twins | NuGet [1.3.1](https://www.nuget.org/packages/Azure.ResourceManager.DigitalTwins/1.3.1) | [docs](/dotnet/api/overview/azure/ResourceManager.DigitalTwins-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DigitalTwins_1.3.1/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/) | | Resource Management - Disconnectedoperations | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.DisconnectedOperations/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.DisconnectedOperations-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DisconnectedOperations_1.0.0-beta.1/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/) | | Resource Management - DNS | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.Dns/1.1.1)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.ResourceManager.Dns/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/ResourceManager.Dns-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dns_1.1.1/sdk/dns/Azure.ResourceManager.Dns/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dns_1.2.0-beta.2/sdk/dns/Azure.ResourceManager.Dns/) | -| Resource Management - DNS Resolver | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.DnsResolver/1.2.0) | [docs](/dotnet/api/overview/azure/ResourceManager.DnsResolver-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DnsResolver_1.2.0/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/) | +| Resource Management - DNS Resolver | NuGet [1.2.0](https://www.nuget.org/packages/Azure.ResourceManager.DnsResolver/1.2.0)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.DnsResolver/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.DnsResolver-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DnsResolver_1.2.0/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DnsResolver_1.3.0-beta.1/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/) | | Resource Management - Durabletask | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.DurableTask/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.DurableTask-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.DurableTask_1.0.0/sdk/durabletask/Azure.ResourceManager.DurableTask/) | | Resource Management - Dynatrace | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.Dynatrace/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.Dynatrace-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Dynatrace_1.1.1/sdk/dynatrace/Azure.ResourceManager.Dynatrace/) | | Resource Management - Edge Order | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.EdgeOrder/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EdgeOrder-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EdgeOrder_1.1.1/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/) |