Skip to content

Commit

Permalink
Merge pull request #43101 from dotnet/main
Browse files Browse the repository at this point in the history
Merge main into live
  • Loading branch information
dotnet-policy-service[bot] authored Oct 17, 2024
2 parents 3836fac + ae045b9 commit 0df9ac5
Show file tree
Hide file tree
Showing 13 changed files with 114 additions and 40 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ charset = utf-8-bom
# Analyzers
dotnet_analyzer_diagnostic.category-Security.severity = error
dotnet_code_quality.ca1802.api_surface = private, internal
# SYSLIB5001: Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
dotnet_diagnostic.SYSLIB5001.severity = suggestion

# Miscellaneous style rules
dotnet_sort_system_directives_first = true
Expand Down
6 changes: 1 addition & 5 deletions .github/policies/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ configuration:
branch: main
- or:
- isActivitySender:
user: azure-sdk
- isActivitySender:
user: dependabot
- isActivitySender:
user: dependabot[bot]
user: dotnet-policy-service[bot]
then:
- enableAutoMerge:
mergeMethod: Squash
Expand Down
14 changes: 7 additions & 7 deletions docs/azure/includes/dotnet-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@
| Communication Calling Windows Client | NuGet [1.9.0](https://www.nuget.org/packages/Azure.Communication.Calling.WindowsClient/1.9.0)<br>NuGet [1.10.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Calling.WindowsClient/1.10.0-beta.1) | | |
| DotNetty | NuGet [0.7.6](https://www.nuget.org/packages/DotNetty.Common/0.7.6) | | |
| HTTP ASPNETCore Analyzers | NuGet [1.0.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.Analyzers/1.0.2) | | |
| Item Templates NetCore | NuGet [4.0.5032](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetCore/4.0.5032) | | |
| Item Templates NetFx | NuGet [4.0.5032](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetFx/4.0.5032) | | |
| Item Templates NetCore | NuGet [4.0.5035](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetCore/4.0.5035) | | |
| Item Templates NetFx | NuGet [4.0.5035](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetFx/4.0.5035) | | |
| Microsoft.Azure.DataFactoryTestingFramework.Expressions | NuGet [0.2.7](https://www.nuget.org/packages/Microsoft.Azure.DataFactoryTestingFramework.Expressions/0.2.7) | | |
| Microsoft.Azure.Functions.Worker.OpenTelemetry | NuGet [1.1.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.OpenTelemetry/1.1.0-preview2) | | |
| System Net Client Model | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/System.Net.ClientModel/1.0.0-beta.1) | | |
Expand Down Expand Up @@ -392,7 +392,7 @@
| Common | NuGet [2.2.1](https://www.nuget.org/packages/Microsoft.Azure.Common/2.2.1) | | |
| Common - Dependencies | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Common.Dependencies/1.0.0) | | |
| Computer Vision | NuGet [7.0.1](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Vision.ComputerVision/7.0.1) | | GitHub [7.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Vision.ComputerVision_6.0.0-preview.1/sdk/cognitiveservices/Vision.ComputerVision) |
| Cosmos DB | NuGet [3.42.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.42.0)<br>NuGet [3.45.0-preview.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.45.0-preview.0) | [docs](https://learn.microsoft.com/dotnet/api/overview/azure/cosmosdb) | GitHub [3.42.0](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/3.12.0/Microsoft.Azure.Cosmos) |
| Cosmos DB | NuGet [3.42.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.42.0)<br>NuGet [3.45.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.45.0-preview.1) | [docs](https://learn.microsoft.com/dotnet/api/overview/azure/cosmosdb) | GitHub [3.42.0](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/3.12.0/Microsoft.Azure.Cosmos) |
| Custom Image Search | NuGet [2.1.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.BingCustomImageSearch/2.1.0-preview.1) | | GitHub [2.1.0-preview.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Search.BingCustomImageSearch_2.1.0-preview.1/sdk/cognitiveservices/Search.BingCustomImageSearch) |
| Custom Image Search | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.CustomImageSearch/2.0.0) | | |
| Custom Search | NuGet [2.1.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.BingCustomSearch/2.1.0-preview.1) | | GitHub [2.1.0-preview.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Search.BingCustomSearch_2.1.0-preview.1/sdk/cognitiveservices/Search.BingCustomSearch) |
Expand Down Expand Up @@ -501,10 +501,10 @@
| Functions Extensions - Redis | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Redis/1.0.0) | | |
| Functions Extensions - Redis | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Redis/1.0.0) | | |
| Functions Extensions - Worker Extentions | NuGet [1.0.1](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Dapr/1.0.1) | | |
| Functions item template pack for Microsoft Template Engine | NuGet [4.0.5032](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ItemTemplates/4.0.5032) | | GitHub [4.0.5032](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) |
| Functions item template pack for Microsoft Template Engine | NuGet [4.0.5035](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ItemTemplates/4.0.5035) | | GitHub [4.0.5035](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) |
| Functions OpenAPI app settings deserialization library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/1.4.0)<br>NuGet [2.0.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/2.0.0-preview2) | | |
| Functions OpenAPI document and Swagger UI renderer library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/1.4.0)<br>NuGet [2.0.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/2.0.0-preview2) | | |
| Functions project template pack for Microsoft Template Engine | NuGet [4.0.5032](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ProjectTemplates/4.0.5032) | | GitHub [4.0.5032](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) |
| Functions project template pack for Microsoft Template Engine | NuGet [4.0.5035](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ProjectTemplates/4.0.5035) | | GitHub [4.0.5035](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) |
| Functions runtime assemblies for App Insights logging | NuGet [3.0.41](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/3.0.41) | | GitHub [3.0.41](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18/src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights) |
| Functions runtime assemblies for logging | NuGet [4.0.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging/4.0.3) | | GitHub [4.0.3](https://github.com/Azure/azure-webjobs-sdk/tree/dev/src/Microsoft.Azure.WebJobs.Logging) |
| Functions runtime assemblies for Microsoft.Azure.WebJobs.Host | NuGet [3.0.41](https://www.nuget.org/packages/Microsoft.Azure.WebJobs/3.0.41) | | GitHub [3.0.41](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18/src/Microsoft.Azure.WebJobs) |
Expand Down Expand Up @@ -538,8 +538,8 @@
| Microsoft.Azure.Functions.Worker.Extensions.Timer | NuGet [4.3.1](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Timer/4.3.1) | | |
| Microsoft.Azure.Functions.Worker.Extensions.Warmup | NuGet [4.0.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Warmup/4.0.2) | | |
| Microsoft.Azure.Functions.Worker.Grpc | NuGet [1.17.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Grpc/1.17.0)<br>NuGet [2.0.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Grpc/2.0.0-preview2) | | |
| Microsoft.Azure.Functions.Worker.ItemTemplates | NuGet [4.0.5032](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates/4.0.5032) | | |
| Microsoft.Azure.Functions.Worker.ProjectTemplates | NuGet [4.0.5032](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ProjectTemplates/4.0.5032) | | |
| Microsoft.Azure.Functions.Worker.ItemTemplates | NuGet [4.0.5035](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates/4.0.5035) | | |
| Microsoft.Azure.Functions.Worker.ProjectTemplates | NuGet [4.0.5035](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ProjectTemplates/4.0.5035) | | |
| Microsoft.Azure.Functions.Worker.Sdk | NuGet [1.17.4](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk/1.17.4)<br>NuGet [2.0.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk/2.0.0-preview2) | | |
| 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.4](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk.Generators/1.3.4) | | |
Expand Down
68 changes: 68 additions & 0 deletions docs/core/tools/dotnet-add-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,74 @@ The *ToDo.csproj* file now contains a [`<PackageReference>`](/nuget/consume-pack
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.4" />
```

If the project is onboarded onto [Central Package Management (CPM)](https://devblogs.microsoft.com/nuget/introducing-central-package-management/) the `<PackageVersion>` element in the `Directory.Packages.props file` is added/updated and the `<PackageReference>` element is added to the project file.

The following scenarios are currently supported. These examples assume that the latest version of `Microsoft.EntityFrameworkCore` is 6.0.4. Additional scenarios related to CPM are documented in [this design spec](https://github.com/NuGet/Home/pull/11915).

Scenario 1: `<PackageReference>` does not exist in the project file, `<PackageVersion>` element does not exist in the `Directory.Packages.props file`, and the version argument is not passed from the commandline.

CLI command that is executed: `dotnet add ToDo.csproj package Microsoft.EntityFrameworkCore`

The `<PackageVersion>` element is added to the `Directory.Packages.props file`.

```xml
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="6.0.4" />
```

The `<PackageReference>` element is added to the project file.

```xml
<PackageReference Include="Microsoft.EntityFrameworkCore" />
```

Scenario 2: `<PackageReference>` does not exist in the project file, `<PackageVersion>` element does not exist in the `Directory.Packages.props file`, and the version argument is passed from the commandline.

CLI command that is executed: `dotnet add ToDo.csproj package Microsoft.EntityFrameworkCore --version 5.0.4`

The `<PackageVersion>` element is added to the `Directory.Packages.props file`.

```xml
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="5.0.4" />
```

The `<PackageReference>` element is added to the project file.

```xml
<PackageReference Include="Microsoft.EntityFrameworkCore" />
```

Scenario 3: `<PackageReference>` does not exist in the project file, `<PackageVersion>` element does exist in the `Directory.Packages.props file`, and the version argument is not passed from the commandline.

CLI command that is executed: `dotnet add ToDo.csproj package Microsoft.EntityFrameworkCore`

The `<PackageVersion>` element is added to the `Directory.Packages.props file`.

```xml
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="6.0.4" />
```

The `<PackageReference>` element is added to the project file.

```xml
<PackageReference Include="Microsoft.EntityFrameworkCore" />
```

Scenario 4: `<PackageReference>` does not exist in the project file, `<PackageVersion>` element does exist in the `Directory.Packages.props file`, and the version argument is passed from the commandline.

CLI command that is executed: `dotnet add ToDo.csproj package Microsoft.EntityFrameworkCore --version 5.0.4`

The `<PackageVersion>` element is added to the `Directory.Packages.props file`.

```xml
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="5.0.4" />
```

The `<PackageReference>` element is added to the project file.

```xml
<PackageReference Include="Microsoft.EntityFrameworkCore" />
```

### Implicit restore

[!INCLUDE[DotNet Restore Note](../../../includes/dotnet-restore-note.md)]
Expand Down
3 changes: 2 additions & 1 deletion docs/core/whats-new/snippets/dotnet-9/csharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
//Channels.RunIt();
//RegularExpressions.RunIt();
//Collections.RunIt();
Diagnostics.RunIt();
//Diagnostics.RunIt();
Tensors.RunIt();
6 changes: 3 additions & 3 deletions docs/core/whats-new/snippets/dotnet-9/csharp/Project.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.22.0-beta.1" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.22.2" />
<PackageReference Include="Microsoft.ML.Tokenizers" Version="0.21.1" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Net.ServerSentEvents" Version="9.0.0-preview.6.24327.7" />
<PackageReference Include="System.Numerics.Tensors" Version="9.0.0-preview.5.24306.7" />
<PackageReference Include="System.Net.ServerSentEvents" Version="9.0.0-rc.2.24473.5" />
<PackageReference Include="System.Numerics.Tensors" Version="9.0.0-rc.2.24473.5" />
</ItemGroup>

<ItemGroup>
Expand Down
19 changes: 9 additions & 10 deletions docs/core/whats-new/snippets/dotnet-9/csharp/Tensors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,44 @@ public static void RunIt()
{
// <SnippetTensor>
// Create a tensor (1 x 3).
var t0 = Tensor.Create([1, 2, 3], [1, 3]); // [[1, 2, 3]]
Tensor<int> t0 = Tensor.Create([1, 2, 3], [1, 3]); // [[1, 2, 3]]

// Reshape tensor (3 x 1).
var t1 = t0.Reshape(3, 1); // [[1], [2], [3]]
Tensor<int> t1 = t0.Reshape(3, 1); // [[1], [2], [3]]

// Slice tensor (2 x 1).
var t2 = t1.Slice(1.., ..); // [[2], [3]]
Tensor<int> t2 = t1.Slice(1.., ..); // [[2], [3]]

// Broadcast tensor (3 x 1) -> (3 x 3).
// [
// [ 1, 1, 1],
// [ 2, 2, 2],
// [ 3, 3, 3]
// ]
var t3 = Tensor.Broadcast(t1, [3, 3]);
var t3 = Tensor.Broadcast<int>(t1, [3, 3]);

// Math operations.
var t4 = Tensor.Add(t0, 1); // [[2, 3, 4]]
var t5 = Tensor.Add(t0, t0); // [[2, 4, 6]]
var t5 = Tensor.Add(t0.AsReadOnlyTensorSpan(), t0); // [[2, 4, 6]]
var t6 = Tensor.Subtract(t0, 1); // [[0, 1, 2]]
var t7 = Tensor.Subtract(t0, t0); // [[0, 0, 0]]
var t7 = Tensor.Subtract(t0.AsReadOnlyTensorSpan(), t0); // [[0, 0, 0]]
var t8 = Tensor.Multiply(t0, 2); // [[2, 4, 6]]
var t9 = Tensor.Multiply(t0, t0); // [[1, 4, 9]]
var t9 = Tensor.Multiply(t0.AsReadOnlyTensorSpan(), t0); // [[1, 4, 9]]
var t10 = Tensor.Divide(t0, 2); // [[0.5, 1, 1.5]]
var t11 = Tensor.Divide(t0, t0); // [[1, 1, 1]]
var t11 = Tensor.Divide(t0.AsReadOnlyTensorSpan(), t0); // [[1, 1, 1]]
// </SnippetTensor>

// <SnippetCosineSimilarity>
ReadOnlySpan<float> vector1 = [1, 2, 3];
ReadOnlySpan<float> vector2 = [4, 5, 6];
Console.WriteLine(TensorPrimitives.CosineSimilarity(vector1, vector2));

// Prints 0.9746318

ReadOnlySpan<double> vector3 = [1, 2, 3];
ReadOnlySpan<double> vector4 = [4, 5, 6];
Console.WriteLine(TensorPrimitives.CosineSimilarity(vector3, vector4));

// Prints 0.9746318461970762

// </SnippetCosineSimilarity>
}
}
2 changes: 1 addition & 1 deletion docs/csharp/programming-guide/strings/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ms.assetid: 21580405-cb25-4541-89d5-037846a38b07
---
# Strings and string literals

A string is an object of type <xref:System.String> whose value is text. Internally, the text is stored as a sequential read-only collection of <xref:System.Char> objects. There's no null-terminating character at the end of a C# string; therefore a C# string can contain any number of embedded null characters ('\0'). The <xref:System.String.Length%2A> property of a string represents the number of `Char` objects it contains, not the number of Unicode characters. To access the individual Unicode code points in a string, use the <xref:System.Globalization.StringInfo> object.
A string is an object of type <xref:System.String> whose value is text. Internally, the text is stored as a sequential read-only collection of <xref:System.Char> objects. The <xref:System.String.Length%2A> property of a string represents the number of `Char` objects it contains, not the number of Unicode characters. To access the individual Unicode code points in a string, use the <xref:System.Globalization.StringInfo> object.

## string vs. System.String

Expand Down
2 changes: 2 additions & 0 deletions docs/fundamentals/code-analysis/quality-rules/ca2254.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Update the message template to be a constant expression. If you're using values
logger.Warning("Person {FirstName} {LastName} encountered an issue", firstName, lastName);
```

For usage examples, see the <xref:Microsoft.Extensions.Logging.LoggerExtensions.LogInformation%2A?displayProperty=nameWithType> method.

## When to suppress errors

It's safe to suppress a warning from this rule if your use case doesn't require structured logging. It's also safe to suppress this rule if your log message template is defined in a resource file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ The following sections contain links to SQL scripts to configure your database a

| Database | Script | NuGet package| ADO.NET invariant |
|--|--|--|--|
| SQL Server | [SQLServer-Persistence.sql](https://github.com/dotnet/orleans/blob/main/src/AdoNet/Orleans.Persistence.AdoNet/SQLServer-Persistence.sql) | [System.Data.SqlClient](https://www.nuget.org/packages/System.Data.SqlClient/) | `System.Data.SqlClient` |
| SQL Server* | [SQLServer-Persistence.sql](https://github.com/dotnet/orleans/blob/main/src/AdoNet/Orleans.Persistence.AdoNet/SQLServer-Persistence.sql) | [System.Data.SqlClient](https://www.nuget.org/packages/System.Data.SqlClient/) | `System.Data.SqlClient` |
| MySQL / MariaDB | [MySQL-Persistence.sql](https://github.com/dotnet/orleans/blob/main/src/AdoNet/Orleans.Persistence.AdoNet/MySQL-Persistence.sql) | [MySql.Data](https://www.nuget.org/packages/MySql.Data/) | `MySql.Data.MySqlClient` |
| PostgreSQL | [PostgreSQL-Persistence.sql](https://github.com/dotnet/orleans/blob/main/src/AdoNet/Orleans.Persistence.AdoNet/PostgreSQL-Persistence.sql) | [Npgsql](https://www.nuget.org/packages/Npgsql/) | `Npgsql` |
| Oracle | [Oracle-Persistence.sql](https://github.com/dotnet/orleans/blob/main/src/AdoNet/Orleans.Persistence.AdoNet/Oracle-Persistence.sql) | [ODP.net](https://www.nuget.org/packages/Oracle.ManagedDataAccess/) | `Oracle.DataAccess.Client` |

\* If you're using Orleans v3.x use this script template: <https://github.com/dotnet/orleans/blob/3.x/src/AdoNet/Orleans.Persistence.AdoNet/SQLServer-Persistence.sql>

## Reminders

| Database | Script | NuGet package| ADO.NET invariant |
Expand Down
Loading

0 comments on commit 0df9ac5

Please sign in to comment.