Skip to content

Commit 15a92db

Browse files
authored
Merge pull request #46570 from gewarren/publish-060425
Merge main into live
2 parents 2b91b89 + a234f39 commit 15a92db

File tree

19 files changed

+204
-115
lines changed

19 files changed

+204
-115
lines changed

.github/workflows/scorecards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ jobs:
7171

7272
# Upload the results to GitHub's code scanning dashboard.
7373
- name: "Upload to code-scanning"
74-
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
74+
uses: github/codeql-action/upload-sarif@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
7575
with:
7676
sarif_file: results.sarif

.openpublishing.redirection.csharp.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@
116116
"source_path_from_root": "/redirections/proposals/csharp-8.0/nested-stackalloc.md",
117117
"redirect_url": "/dotnet/csharp/language-reference/language-specification/structs#164127-stackalloc"
118118
},
119+
{
120+
"source_path_from_root": "/redirections/proposals/csharp-8.0/readonly-instance-members.md",
121+
"redirect_url": "/dotnet/csharp/language-reference/language-specification/structs#16411-properties"
122+
},
119123
{
120124
"source_path_from_root": "/redirections/proposals/csharp-9.0/nullable-reference-types-specification.md",
121125
"redirect_url": "/dotnet/csharp/language-reference/language-specification/types.md#893-nullable-reference-types"

docfx.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"csharp-8.0/nullable-reference-types.md",
8181
"csharp-8.0/nullable-reference-types-specification.md",
8282
"csharp-8.0/nested-stackalloc.md",
83+
"csharp-8.0/readonly-instance-members.md",
8384
"csharp-9.0/nullable-reference-types-specification.md",
8485
"csharp-9.0/nullable-constructor-analysis.md",
8586
"csharp-9.0/nullable-parameter-default-value-analysis.md",
@@ -621,7 +622,6 @@
621622
"_csharplang/proposals/csharp-8.0/ranges.md": "Ranges and indices",
622623
"_csharplang/proposals/csharp-8.0/using.md": "Pattern based using and using declarations",
623624
"_csharplang/proposals/csharp-8.0/null-coalescing-assignment.md": "Null coalescing assignment",
624-
"_csharplang/proposals/csharp-8.0/readonly-instance-members.md": "Readonly instance members",
625625
"_csharplang/proposals/csharp-9.0/covariant-returns.md": "Covariant return types",
626626
"_csharplang/proposals/csharp-9.0/extending-partial-methods.md": "Extending partial methods",
627627
"_csharplang/proposals/csharp-9.0/extension-getenumerator.md": "Extension GetEnumerator support in foreach",
@@ -748,7 +748,6 @@
748748
"_csharplang/proposals/csharp-8.0/ranges.md": "This feature specification describes the syntax for ranges and indices, which support indexing individual elements of a sequence or a range of a sequence from the start or end of that sequence.",
749749
"_csharplang/proposals/csharp-8.0/using.md": "This feature specification supports pattern based using and using declarations to simplify resource cleanup.",
750750
"_csharplang/proposals/csharp-8.0/null-coalescing-assignment.md": "This feature specification describes the syntax to support null coalescing assignment expressions using the '??=' operator.",
751-
"_csharplang/proposals/csharp-8.0/readonly-instance-members.md": "This feature specification describes the syntax for declaring and using readonly instance members.",
752751
"_csharplang/proposals/csharp-9.0/covariant-returns.md": "This feature specification describes covariant return types, where overriding member declarations can return a type derived from the overridden member declaration.",
753752
"_csharplang/proposals/csharp-9.0/extending-partial-methods.md": "This feature specification describes extensions to partial methods. These extensions enable source generators to create or call partial methods.",
754753
"_csharplang/proposals/csharp-9.0/extension-getenumerator.md": "This feature specification describes the necessary pattern for an extension method to provide the GetEnumerator support in a foreach loop.",

docs/ai/quickstarts/snippets/mcp-server/MinimalMcpServer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.5" />
12-
<PackageReference Include="ModelContextProtocol" Version="0.2.0-preview.2" />
12+
<PackageReference Include="ModelContextProtocol" Version="0.2.0-preview.3" />
1313
</ItemGroup>
1414

1515
</Project>

docs/architecture/microservices/architect-microservice-container-applications/resilient-high-availability-microservices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Logs provide information about how an application or service is running, includi
3636

3737
In monolithic server-based applications, you can write logs to a file on disk (a logfile) and then analyze it with any tool. Since application execution is limited to a fixed server or VM, it generally isn't too complex to analyze the flow of events. However, in a distributed application where multiple services are executed across many nodes in an orchestrator cluster, being able to correlate distributed events is a challenge.
3838

39-
A microservice-based application should not try to store the output stream of events or logfiles by itself, and not even try to manage the routing of the events to a central place. It should be transparent, meaning that each process should just write its event stream to a standard output that underneath will be collected by the execution environment infrastructure where it's running. An example of these event stream routers is [Microsoft.Diagnostic.EventFlow](https://github.com/Azure/diagnostics-eventflow), which collects event streams from multiple sources and publishes it to output systems. These can include simple standard output for a development environment or cloud systems like [Azure Monitor](https://azure.microsoft.com/services/monitor//) and [Azure Diagnostics](/azure/azure-monitor/platform/diagnostics-extension-overview). There are also good third-party log analysis platforms and tools that can search, alert, report, and monitor logs, even in real time, like [Splunk](https://www.splunk.com/goto/Splunk_Log_Management?ac=ga_usa_log_analysis_phrase_Mar17&_kk=logs%20analysis&gclid=CNzkzIrex9MCFYGHfgodW5YOtA).
39+
A microservice-based application should not try to store the output stream of events or logfiles by itself, and not even try to manage the routing of the events to a central place. It should be transparent, meaning that each process should just write its event stream to a standard output that underneath will be collected by the execution environment infrastructure where it's running. An example of these event stream routers is [Microsoft.Diagnostic.EventFlow](https://github.com/Azure/diagnostics-eventflow), which collects event streams from multiple sources and publishes it to output systems. These can include simple standard output for a development environment or cloud systems like [Azure Monitor](https://azure.microsoft.com/services/monitor//) and [Azure Diagnostics](/azure/azure-monitor/platform/diagnostics-extension-overview). There are also good third-party log analysis platforms and tools that can search, alert, report, and monitor logs, even in real time, like [Splunk](https://www.splunk.com/goto/Splunk_Log_Management?ac=ga_usa_log_analysis_phrase_Mar17&_kk=logs%20analysis&gclid=CNzkzIrex9MCFYGHfgodW5YOtA) or [Middleware](https://middleware.io).
4040

4141
### Orchestrators managing health and diagnostics information
4242

docs/azure/sdk/snippets/unit-testing/UnitTestingSampleApp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<ItemGroup>
1313
<PackageReference Include="Azure.Core" Version="1.46.1" />
1414
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.7.0" />
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
1616
<PackageReference Include="Moq" Version="[4.20.72]" /> <!-- Context: https://github.com/Azure/azure-sdk-for-net/issues/38111 -->
1717
<PackageReference Include="NSubstitute" Version="5.3.0" />
1818
<PackageReference Include="xunit" Version="2.9.3" />

docs/core/testing/snippets/unit-testing-using-mstest/csharp/PrimeService.Tests/PrimeService.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
1111
<PackageReference Include="MSTest.TestAdapter" Version="3.9.1" />
1212
<PackageReference Include="MSTest.TestFramework" Version="3.9.1" />
1313
<PackageReference Include="coverlet.collector" Version="6.0.4">

docs/core/testing/unit-testing-mstest-writing-tests-attributes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: MSTest attributes
33
description: Learn about the various attributes of MSTest.
44
author: Evangelink
55
ms.author: amauryleve
6-
ms.date: 07/24/2024
6+
ms.date: 05/30/2025
77
---
88

99
# MSTest attributes
@@ -73,7 +73,7 @@ Use the following elements to set up data-driven tests. For more information, se
7373
- <xref:Microsoft.VisualStudio.TestTools.UnitTesting.DynamicDataAttribute>
7474

7575
> [!TIP]
76-
> While combinatorial testing isn't directly supported by MSTest, an external [Combinatorial.MSTest NuGet packages](https://www.nuget.org/packages/Combinatorial.MSTest/) adds that support. The package is open source maintained on [Combinatorial.MSTest GitHub repository](https://github.com/Youssef1313/Combinatorial.MSTest). This package is not maintained by Microsoft.
76+
> MSTest doesn't natively support combinatorial testing, but you can add this capability using the open-source [Combinatorial.MSTest](https://www.nuget.org/packages/Combinatorial.MSTest) NuGet package. It's actively maintained by the [community and available on GitHub](https://github.com/Youssef1313/Combinatorial.MSTest). This package isn't maintained by Microsoft.
7777
7878
### `DataRowAttribute`
7979

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: MSTest test lifecycle
3+
description: Learn about the creation and lifecycle of test classes and test methods in MSTest.
4+
author: marcelwgn
5+
ms.author: marcelwagner
6+
ms.date: 06/03/2025
7+
---
8+
9+
# MSTest lifecycle
10+
11+
MSTest provides a well-defined lifecycle for test classes and test methods, allowing for setup and teardown operations to be performed at various stages of the test execution process. The lifecycle can be grouped into the following three stages:
12+
13+
- Assembly-level lifecycle
14+
- Class-level lifecycle
15+
- Test-level lifecycle
16+
17+
The execution of the lifecycle events occurs from the highest level (assembly) to the lowest level (test method). The order of execution is as follows:
18+
19+
1. Assembly Initialization
20+
1. Class Initialization (for every test class)
21+
1. Test initialization (for every test method)
22+
1. Test Execution
23+
1. Test Cleanup (for every test method)
24+
1. Class Cleanup (for every test class)
25+
1. Assembly Cleanup
26+
27+
## Assembly-level Lifecycle
28+
29+
The assembly lifecycle describes the lifecycle of the entire assembly, which includes all test classes and methods.
30+
To manage the assembly lifecycle, MSTest provides the [AssemblyInitialize](xref:Microsoft.VisualStudio.TestTools.UnitTesting.AssemblyInitializeAttribute) and [AssemblyCleanup](xref:Microsoft.VisualStudio.TestTools.UnitTesting.AssemblyCleanupAttribute) attributes.
31+
To learn more about these attributes, refer to the [AssemblyInitialize and AssemblyCleanup](./unit-testing-mstest-writing-tests-attributes.md#assembly-level) documentation.
32+
33+
## Class-level Lifecycle
34+
35+
The test class lifecycle refers to the lifecycle of individual test classes within the assembly and can be implemented using the [ClassInitialize](xref:Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute) and [ClassCleanup](xref:Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute) attributes.
36+
These attributes allow you to define setup and teardown methods that are executed before and after all tests in a class, respectively.
37+
For more information on these attributes, refer to the [ClassInitialize and ClassCleanup](./unit-testing-mstest-writing-tests-attributes.md#class-level) documentation.
38+
The class level lifecycle is only run once per class, regardless of the number of tests in a class.
39+
40+
## Test-level Lifecycle
41+
42+
The test level lifecycle is executed for every test method. For parameterized tests, each set of parameters is treated as a separate test method, and the lifecycle is executed for each set of parameters.
43+
Test level lifecycle can be grouped into setup, execution and cleanup with setup and cleanup supporting multiple ways to be implemented.
44+
45+
#### Setup
46+
47+
The setup phase of the test level lifecycle is responsible for preparing the test environment before the execution of each test method. This can be achieved using the `TestInitialize` attribute or by implementing a constructor in the test class. In the case of inheritance, execution of `TestInitialize` methods follows the order from the base class to the derived class. If a test class implements a constructor, it is executed before the `TestInitialize` method. To learn more about the `TestInitialize` attribute, refer to the [test level attribute](./unit-testing-mstest-writing-tests-attributes.md#test-level) documentation.
48+
49+
> [!NOTE]
50+
> Unlike the class constructor, `TestInitialize` methods can be async and also support attribute usage such as the `TimeoutAttribute`.
51+
52+
#### Execution
53+
54+
The execution phase is the phase where the actual test method is executed. If a test method returns a Task or ValueTask, the test method will be awaited.
55+
56+
> [!WARNING]
57+
> In the case of asynchronous test methods, no [SynchronizationContext](xref:System.Threading.SynchronizationContext) is provided. This does not apply to `UITestMethod` tests for UWP and WinUI as they run on the UI thread which has a [SynchronizationContext](xref:System.Threading.SynchronizationContext).
58+
59+
#### Cleanup
60+
61+
The cleanup phase of the test level lifecycle is responsible for cleaning up the test environment after the execution of each test method.
62+
This can be achieved using the `TestCleanup` attribute or by implementing the `IDisposable`/`IAsyncDisposable` interface in the test class.
63+
If a test class implements `IDisposable` or `IAsyncDisposable`, its `Dispose`/`DisposeAsync` method is executed after the `TestCleanup` method.
64+
In case of inheritance, execution of `TestCleanup` methods follows the order from the derived class to the base class.
65+
To learn more about the `TestInitialize` attribute, refer to the [test level attribute](./unit-testing-mstest-writing-tests-attributes.md#test-level) documentation.
66+
67+
#### Order
68+
69+
The complete order of the test level lifecycle is as follows:
70+
71+
1. Create instance of test class
72+
1. Set `TestContext` property if present
73+
1. Run TestInitialize (if implemented)
74+
1. Test method execution
75+
1. Update `TestContext` with test results (such as `Outcome` property)
76+
1. Run TestCleanup if implemented
77+
1. Run DisposeAsync if implemented
78+
1. Run Dispose if implemented

docs/csharp/language-reference/builtin-types/ref-struct.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ The compiler enforces these restrictions. If you write `ref struct` types that i
8383
For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md):
8484

8585
- [Structs: Ref modifier](~/_csharpstandard/standard/structs.md#1623-ref-modifier)
86-
- [Safe context constraint for ref struct types](~/_csharpstandard/standard/structs.md#16412-safe-context-constraint)
86+
- [Safe context constraint for ref struct types](~/_csharpstandard/standard/structs.md#16415-safe-context-constraint)
8787

8888
For more information about `ref` fields, see the [Low-level struct improvements](~/_csharplang/proposals/csharp-11.0/low-level-struct-improvements.md) proposal note.
8989

0 commit comments

Comments
 (0)