Skip to content

Commit 42e0e3e

Browse files
Merge pull request #49548 from dotnet/main
Merge main into live
2 parents 8ff974a + 5aad86d commit 42e0e3e

File tree

5 files changed

+57
-18
lines changed

5 files changed

+57
-18
lines changed

docs/core/testing/microsoft-testing-platform-migration-from-v1-to-v2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: ygerges
66
ms.date: 10/08/2025
77
---
88

9-
# Mirate from Microsoft.Testing.Platform v1 to v2
9+
# Migrate from Microsoft.Testing.Platform v1 to v2
1010

1111
The stable version Microsoft.Testing.Platform v2 is now available. This migration guide explores what's changed in Microsoft.Testing.Platform v2 and how you can migrate to this version.
1212

docs/csharp/language-reference/operators/patterns.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ You can also add a run-time type check and a variable declaration to a property
182182

183183
:::code language="csharp" source="snippets/patterns/PropertyPattern.cs" id="WithTypeCheck":::
184184

185+
This specifically means that the *empty* property pattern `is { }` matches everything non-null, and can be used instead of the `is not null` to create a variable: `somethingPossiblyNull is { } somethingDefinitelyNotNull`.
186+
187+
:::code language="csharp" source="snippets/patterns/PropertyPattern.cs" id="EmptyPropertyPattern":::
188+
185189
A property pattern is a recursive pattern. You can use any pattern as a nested pattern. Use a property pattern to match parts of data against nested patterns, as the following example shows:
186190

187191
:::code language="csharp" source="snippets/patterns/PropertyPattern.cs" id="RecursivePropertyPattern":::

docs/csharp/language-reference/operators/snippets/patterns/PropertyPattern.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,27 @@ public static class PropertyPattern
55
public static void Examples()
66
{
77
WithTypeCheck();
8+
9+
// <EmptyPropertyPattern>
10+
if (GetSomeNullableStringValue() is { } nonNullValue) // Empty property pattern with variable creation
11+
{
12+
Console.WriteLine("NotNull:" + nonNullValue);
13+
}
14+
else
15+
{
16+
nonNullValue = "NullFallback"; // we can access the variable here.
17+
Console.WriteLine("it was null, here's the fallback: " + nonNullValue);
18+
}
19+
// </EmptyPropertyPattern>
20+
821
}
922

23+
private static string? GetSomeNullableStringValue()
24+
{
25+
// Simulate getting a nullable string value.
26+
return DateTime.Now.Ticks % 2 == 0 ? "Hello, World!" : null;
27+
}
28+
1029
// <BasicExample>
1130
static bool IsConferenceDay(DateTime date) => date is { Year: 2020, Month: 5, Day: 19 or 20 or 21 };
1231
// </BasicExample>

docs/fundamentals/code-analysis/quality-rules/ca1806.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "CA1806: Do not ignore method results (code analysis)"
33
description: "Learn about code analysis rule CA1806: Do not ignore method results"
4-
ms.date: 06/08/2022
4+
ms.date: 10/30/2025
55
f1_keywords:
66
- CA1806
77
- DoNotIgnoreMethodResults
@@ -32,6 +32,7 @@ There are several possible reasons for this warning:
3232
- A method that creates and returns a new string is called and the new string is never used.
3333
- A COM or P/Invoke method returns a `HRESULT` or error code that's never used.
3434
- A language-integrated query (LINQ) method returns a result that's never used.
35+
- A `[Pure]` method is called and the return value is never used.
3536

3637
## Rule description
3738

@@ -41,7 +42,7 @@ Strings are immutable and methods such as <xref:System.String.ToUpper%2A?display
4142

4243
Ignoring `HRESULT` or an error code can lead to low-resource conditions or unexpected behavior in error conditions.
4344

44-
LINQ methods are known to not have side effects, and the result should not be ignored.
45+
LINQ methods and methods annotated with <xref:System.Diagnostics.Contracts.PureAttribute> are known to not have side effects, and the result should not be ignored.
4546

4647
## How to fix violations
4748

@@ -57,7 +58,7 @@ If method A calls method B but does not use the `HRESULT` or error code that the
5758

5859
-or-
5960

60-
If a LINQ method A calls method B but does not use the result, use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.
61+
If method A calls a LINQ or pure method B but does not use the result, use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.
6162

6263
## When to suppress warnings
6364

@@ -122,7 +123,7 @@ The following example fixes the violation by assigning the result of <xref:Syste
122123
The following example shows a method that doesn't use an object that it creates.
123124

124125
> [!NOTE]
125-
> This violation cannot be reproduced in Visual Basic.
126+
> This violation can't be reproduced in Visual Basic.
126127
127128
:::code language="csharp" source="snippets/csharp/all-rules/ca1806.cs" id="snippet3":::
128129

docs/visual-basic/reference/command-line-compiler/how-to-invoke-the-command-line-compiler.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,66 @@ helpviewer_keywords:
99
- "command line [Visual Basic], arguments"
1010
ms.assetid: 0fd9a8f6-f34e-4c35-a49d-9b9bbd8da4a9
1111
---
12-
# How to: Invoke the Command-Line Compiler (Visual Basic)
12+
# How to Invoke the Command-Line Compiler
1313

1414
You can invoke the command-line compiler by typing the name of its executable file into the command line, also known as the MS-DOS prompt. If you compile from the default Windows Command Prompt, you must type the fully qualified path to the executable file. To override this default behavior, you can either use the Developer Command Prompt for Visual Studio, or modify the PATH environment variable. Both allow you to compile from any directory by simply typing the compiler name.
1515

16+
[!TIP]
17+
For modern .NET projects, use the [`dotnet build`](../../../core/tools/dotnet-build.md) command to compile Visual Basic source files.
18+
The `vbc.exe` command-line compiler is only used for older .NET Framework projects.
19+
1620
[!INCLUDE[note_settings_general](~/includes/note-settings-general-md.md)]
1721

1822
## To invoke the compiler using the Developer Command Prompt for Visual Studio
1923

2024
1. Open the Visual Studio Tools program folder within the Microsoft Visual Studio program group.
2125

22-
2. You can use the Developer Command Prompt for Visual Studio to access the compiler from any directory on your machine, if Visual Studio is installed.
26+
1. You can use the **Developer Command Prompt for Visual Studio** to access the compiler from any directory on your machine, if Visual Studio is installed.
27+
28+
1. Open the **Developer Command Prompt for Visual Studio**.
2329

24-
3. Invoke the Developer Command Prompt for Visual Studio.
30+
1. At the command line, type `vbc.exe <sourceFileName>` and then press **Enter**.
2531

26-
4. At the command line, type `vbc.exe` *sourceFileName* and then press ENTER.
32+
For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type:
2733

28-
For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type `cd SourceFiles` to change to that directory. If the directory contained a source file named `Source.vb`, you could compile it by typing `vbc.exe Source.vb`.
34+
```cmd
35+
cd SourceFiles
36+
vbc.exe Source.vb
37+
```
2938

3039
## To set the PATH environment variable to the compiler for the Windows Command Prompt
3140

3241
1. Use the Windows Search feature to find Vbc.exe on your local disk.
3342

3443
The exact name of the directory where the compiler is located depends on the location of the Windows directory and the version of the ".NET Framework" installed. If you have more than one version of the ".NET Framework" installed, you must determine which version to use (typically the latest version).
3544

36-
2. From your **Start** Menu, right-click **My Computer**, and then click **Properties** from the shortcut menu.
45+
1. From your **Start** Menu, right-click **My Computer**, and then click **Properties** from the shortcut menu.
3746

38-
3. Click the **Advanced** tab, and then click **Environment Variables**.
47+
1. Click the **Advanced** tab, and then click **Environment Variables**.
3948

40-
4. In the **System** variables pane, select **Path** from the list and click **Edit**.
49+
1. In the **System** variables pane, select **Path** from the list and click **Edit**.
4150

42-
5. In the **Edit System** Variable dialog box, move the insertion point to the end of the string in the **Variable Value** field and type a semicolon (;) followed by the full directory name found in Step 1.
51+
1. In the **Edit System** Variable dialog box, move the insertion point to the end of the string in the **Variable Value** field and type a semicolon (;) followed by the full directory name found in Step 1.
4352

44-
6. Click **OK** to confirm your edits and close the dialog boxes.
53+
1. Click **OK** to confirm your edits and close the dialog boxes.
4554

46-
After you change the PATH environment variable, you can run the Visual Basic compiler at the Windows Command Prompt from any directory on the computer.
55+
After you change the PATH environment variable, you can run the Visual Basic compiler at the Windows Command Prompt from any directory on the computer.
4756

4857
## To invoke the compiler using the Windows Command Prompt
4958

5059
1. From the **Start** menu, click on the **Accessories** folder, and then open the **Windows Command Prompt**.
5160

52-
2. At the command line, type `vbc.exe`*sourceFileName* and then press ENTER.
61+
1. At the command line, type `vbc.exe <sourceFileName>` and then press **Enter**.
62+
63+
For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type:
5364

54-
For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type `cd SourceFiles` to change to that directory. If the directory contained a source file named `Source.vb`, you could compile it by typing `vbc.exe Source.vb`.
65+
```cmd
66+
cd SourceFiles
67+
vbc.exe Source.vb
68+
```
5569

5670
## See also
5771

5872
- [Visual Basic Command-Line Compiler](index.md)
5973
- [Conditional Compilation](../../programming-guide/program-structure/conditional-compilation.md)
74+
- [dotnet build](../../../core/tools/dotnet-build.md) — for modern .NET SDK usage

0 commit comments

Comments
 (0)