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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11
uses: github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
with:
sarif_file: results.sarif
4 changes: 2 additions & 2 deletions docs/ai/semantic-kernel-dotnet-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ string memoryCollectionName = "SummarizedAzureDocs";
foreach (var fact in facts) {
await memoryBuilder.SaveReferenceAsync(
collection: memoryCollectionName,
description: fact.Key.Split(";")[1].Trim(),
description: fact.Key.Split(";")[0].Trim(),
text: fact.Value,
externalId: fact.Key.Split(";")[2].Trim(),
externalId: fact.Key.Split(";")[1].Trim(),
externalSourceName: "Azure Documentation"
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.18.4" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.7.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.24.0" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.10.0" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.11.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion docs/azure/sdk/snippets/pagination/pagination.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.10.0" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.11.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.3" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion docs/core/diagnostics/lldb-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To install the LLDB packages:

```console
apk update
apk add lldb
apk add lldb py3-lldb
```

To launch LLDB:
Expand Down
20 changes: 12 additions & 8 deletions docs/core/tools/dotnet-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Some examples of the `dotnet.config` file:
name = "VSTest"
```

## VSTest and Microsoft Testing Platform (MTP)
## VSTest and Microsoft.Testing.Platform (MTP)

### [dotnet test with VSTest](#tab/dotnet-test-with-vstest)

Expand Down Expand Up @@ -441,14 +441,18 @@ dotnet test -h|--help
With Microsoft Testing Platform, `dotnet test` operates faster than with VSTest. The test-related arguments are no longer fixed, as they are tied to the registered extensions in the test project(s). Moreover, MTP supports a globbing filter when running tests. For more information, see [Microsoft.Testing.Platform](../testing/microsoft-testing-platform-intro.md).

> [!WARNING]
> `dotnet test` doesn't run in environments that have test projects using both VSTest and Microsoft Testing Platform in the same solution, as the two platforms are mutually incompatible.
> When Microsoft.Testing.Platform is opted in via `dotnet.config`, `dotnet test` expects all test projects to use Microsoft.Testing.Platform. It is an error if any of the test projects use VSTest.

#### Implicit restore

[!INCLUDE[dotnet restore note](~/includes/dotnet-restore-note.md)]

#### Options

> [!NOTE]
> You can use only one of the following options at a time: `--project`, `--solution`, `--directory`, or `--test-modules`. These options can't be combined.
> In addition, when using `--test-modules`, you can't specify `--arch`, `--configuration`, `--framework`, `--os`, or `--runtime`. These options are not relevant for an already-built module.

- **`--project <PROJECT_PATH>`**

Specifies the path to the test project.
Expand All @@ -461,9 +465,6 @@ With Microsoft Testing Platform, `dotnet test` operates faster than with VSTest.

Specifies the path to a directory that contains a project or a solution.

> [!NOTE]
> You can use only one of the following options at a time: `--project`, `--solution`, or `--directory`. These options can't be combined.

- **`--test-modules <EXPRESSION>`**

Filters test modules using file globbing in .NET. Only tests belonging to those test modules will run. For more information and examples on how to use file globbing in .NET, see [File globbing](../../../docs/core/extensions/file-globbing.md).
Expand Down Expand Up @@ -533,14 +534,17 @@ With Microsoft Testing Platform, `dotnet test` operates faster than with VSTest.

- **`args`**

Specifies extra arguments to pass to the test application(s). Use a space to separate multiple arguments. For more information and examples on what to pass, see [Microsoft Testing Platform](../../../docs/core/testing/microsoft-testing-platform-intro.md) and [Microsoft.Testing.Platform extensions](../../../docs/core/testing/microsoft-testing-platform-extensions.md).
Specifies extra arguments to pass to the test application(s). Use a space to separate multiple arguments. For more information and examples on what to pass, see [Microsoft.Testing.Platform overview](../../../docs/core/testing/microsoft-testing-platform-intro.md) and [Microsoft.Testing.Platform extensions](../../../docs/core/testing/microsoft-testing-platform-extensions.md).

> [!TIP]
> To specify extra arguments for specific projects, use the `TestingPlatformCommandLineArguments` MSBuild property.

> [!NOTE]
> To enable trace logging to a file, use the environment variable `DOTNET_CLI_TEST_TRACEFILE` to provide the path to the trace file.

#### Examples

- Run the tests in the project in the current directory:
- Run the tests in the project or solution in the current directory:

```dotnetcli
dotnet test
Expand All @@ -558,7 +562,7 @@ With Microsoft Testing Platform, `dotnet test` operates faster than with VSTest.
dotnet test --solution ./TestProjects/TestProjects.sln
```

- Run the tests in the `TestProjects` directory:
- Run the tests in a solution or project that can be found in the `TestProjects` directory:

```dotnetcli
dotnet test --directory ./TestProjects
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Linq.Expressions;
using System.Linq.Expressions;
public static class InterpretExpressions
{
public static void ParseExpression()
Expand All @@ -16,8 +16,7 @@ public static void ParseExpression()
ParameterExpression left = (ParameterExpression)operation.Left;
ConstantExpression right = (ConstantExpression)operation.Right;

Console.WriteLine("Decomposed expression: {0} => {1} {2} {3}",
param.Name, left.Name, operation.NodeType, right.Value);
Console.WriteLine($"Decomposed expression: {param.Name} => {left.Name} {operation.NodeType} {right.Value}");

// This code produces the following output:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// See https://aka.ms/new-console-template for more information
// See https://aka.ms/new-console-template for more information


using System.Reflection;
Expand Down Expand Up @@ -35,10 +35,10 @@ from method in type.GetMethods()

foreach (var groupOfMethods in pubTypesQuery)
{
Console.WriteLine("Type: {0}", groupOfMethods.Key);
Console.WriteLine($"Type: {groupOfMethods.Key}");
foreach (var method in groupOfMethods)
{
Console.WriteLine(" {0}", method);
Console.WriteLine($" {method}");
}
}
// </QueryReflection>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using System.Windows;
using Microsoft.AspNetCore.Mvc;

Expand Down Expand Up @@ -111,7 +111,7 @@ private static void Download(string URL)

private static void DoSomethingWithData(object stringData)
{
Console.WriteLine("Displaying data: ", stringData);
Console.WriteLine($"Displaying data: {stringData}");
}

// <GetUsersForDataset>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Text;
using System.Text;

namespace Coding_Conventions_Examples
{
Expand Down Expand Up @@ -32,7 +32,7 @@ public static void DelegateExamples()

public static void DelMethod(string str)
{
Console.WriteLine("DelMethod argument: {0}", str);
Console.WriteLine($"DelMethod argument: {str}");
}
//</snippet14b>

Expand Down Expand Up @@ -174,7 +174,7 @@ static void Main(string[] args)

if ((divisor != 0) && (dividend / divisor) is var result)
{
Console.WriteLine("Quotient: {0}", result);
Console.WriteLine($"Quotient: {result}");
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Exceptions
{
Expand All @@ -22,7 +22,7 @@ public static void Main()
try
{
result = SafeDivision(a, b);
Console.WriteLine("{0} divided by {1} = {2}", a, b, result);
Console.WriteLine($"{a} divided by {b} = {result}");
}
catch (DivideByZeroException)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Example
{
Expand All @@ -20,7 +20,7 @@ static void Main()
// Create struct instance and initialize by using "new".
// Memory is allocated on thread stack.
Person p1 = new Person("Alex", 9);
Console.WriteLine("p1 Name = {0} Age = {1}", p1.Name, p1.Age);
Console.WriteLine($"p1 Name = {p1.Name} Age = {p1.Age}");

// Create new struct object. Note that struct can be initialized
// without using "new".
Expand All @@ -29,10 +29,10 @@ static void Main()
// Assign values to p2 members.
p2.Name = "Spencer";
p2.Age = 7;
Console.WriteLine("p2 Name = {0} Age = {1}", p2.Name, p2.Age);
Console.WriteLine($"p2 Name = {p2.Name} Age = {p2.Age}");

// p1 values remain unchanged because p2 is copy.
Console.WriteLine("p1 Name = {0} Age = {1}", p1.Name, p1.Age);
Console.WriteLine($"p1 Name = {p1.Name} Age = {p1.Age}");
}
}
/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

public class Person
{
Expand All @@ -17,7 +17,7 @@ class Program
static void Main()
{
Person person1 = new Person("Leopold", 6);
Console.WriteLine("person1 Name = {0} Age = {1}", person1.Name, person1.Age);
Console.WriteLine($"person1 Name = {person1.Name} Age = {person1.Age}");

// Declare new person, assign person1 to it.
Person person2 = person1;
Expand All @@ -26,8 +26,8 @@ static void Main()
person2.Name = "Molly";
person2.Age = 16;

Console.WriteLine("person2 Name = {0} Age = {1}", person2.Name, person2.Age);
Console.WriteLine("person1 Name = {0} Age = {1}", person1.Name, person1.Age);
Console.WriteLine($"person2 Name = {person2.Name} Age = {person2.Age}");
Console.WriteLine($"person1 Name = {person1.Name} Age = {person1.Age}");
}
}
/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Keywords;
namespace Keywords;

internal class ParameterModifiers
{
Expand All @@ -9,17 +9,17 @@ internal static void ParamPassingExamples()
// Passing a variable by value means passing a copy of the variable.
// n1 is a value type
int n1 = 5;
System.Console.WriteLine("The value before calling the method: {0}", n1);
System.Console.WriteLine($"The value before calling the method: {n1}");

SquareItValue(n1); // Passing the variable by value.
System.Console.WriteLine("The value after calling the method: {0}", n1);
System.Console.WriteLine($"The value after calling the method: {n1}");

static void SquareItValue(int x)
// The parameter x is passed by value.
// Changes to x will not affect the original value of x.
{
x *= x;
System.Console.WriteLine("The value inside the method: {0}", x);
System.Console.WriteLine($"The value inside the method: {x}");
}
/* Output:
The value before calling the method: 5
Expand Down Expand Up @@ -49,17 +49,17 @@ static void ChangeValue(int[] pArray)
// Passing a value by reference means passing a reference to the variable.
// n is a value type
int n2 = 5;
System.Console.WriteLine("The value before calling the method: {0}", n2);
System.Console.WriteLine($"The value before calling the method: {n2}");

SquareItReference(ref n2); // Passing the variable by reference.
System.Console.WriteLine("The value after calling the method: {0}", n2);
System.Console.WriteLine($"The value after calling the method: {n2}");

static void SquareItReference(ref int x)
// The parameter x is passed by reference.
// Changes to x will affect the original value of x.
{
x *= x;
System.Console.WriteLine("The value inside the method: {0}", x);
System.Console.WriteLine($"The value inside the method: {x}");
}
/* Output:
The value before calling the method: 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void Conversions()
p++;
}
System.Console.WriteLine();
System.Console.WriteLine("The value of the integer: {0}", number);
System.Console.WriteLine($"The value of the integer: {number}");

/* Output:
The 4 bytes of the integer: 00 04 00 00
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <CreateSequence>
// <CreateSequence>
using WalkthroughWritingLinqQueries;

// Create a data source by using a collection initializer.
Expand Down Expand Up @@ -237,7 +237,7 @@ from student in students
select totalScore;

double averageScore = studentQuery.Average();
Console.WriteLine("Class average score = {0}", averageScore);
Console.WriteLine($"Class average score = {averageScore}");

// Output:
// Class average score = 334.166666666667
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Xml.Linq;
using System.Xml.Linq;

namespace StandardQueryOperators;

Expand Down Expand Up @@ -34,7 +34,7 @@ orderby gr.Key

foreach (var obj in query)
{
Console.WriteLine("Words of length {0}:", obj.Length);
Console.WriteLine($"Words of length {obj.Length}:");
foreach (string word in obj.Words)
Console.WriteLine(word);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Properties
{
Expand Down Expand Up @@ -74,20 +74,20 @@ static void Main()
Person person = new Person();

// Print out the name and the age associated with the person:
Console.WriteLine("Person details - {0}", person);
Console.WriteLine($"Person details - {person}");

// Set some values on the person object:
//<Snippet3>
person.Name = "Joe";
person.Age = 99;
//</Snippet3>
Console.WriteLine("Person details - {0}", person);
Console.WriteLine($"Person details - {person}");

// Increment the Age property:
//<Snippet5>
person.Age += 1;
//</Snippet5>
Console.WriteLine("Person details - {0}", person);
Console.WriteLine($"Person details - {person}");

// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using CustomExtensions;
using CustomExtensions;

string s = "The quick brown fox jumped over the lazy dog.";
// Call the method as if it were an
// instance method on the type. Note that the first
// parameter is not specified by the calling code.
int i = s.WordCount();
System.Console.WriteLine("Word count of s is {0}", i);
System.Console.WriteLine($"Word count of s is {i}");


namespace CustomExtensions
Expand Down
Loading
Loading