From 9721098649c441593a104d83494f811dda965f8a Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Thu, 30 Oct 2025 14:44:07 +0100 Subject: [PATCH 1/5] Fix typo (Mirate->Migrate) in MTP v2 migration doc (#49537) --- .../microsoft-testing-platform-migration-from-v1-to-v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/testing/microsoft-testing-platform-migration-from-v1-to-v2.md b/docs/core/testing/microsoft-testing-platform-migration-from-v1-to-v2.md index 5d300df35e400..00afabb9530e0 100644 --- a/docs/core/testing/microsoft-testing-platform-migration-from-v1-to-v2.md +++ b/docs/core/testing/microsoft-testing-platform-migration-from-v1-to-v2.md @@ -6,7 +6,7 @@ ms.author: ygerges ms.date: 10/08/2025 --- -# Mirate from Microsoft.Testing.Platform v1 to v2 +# Migrate from Microsoft.Testing.Platform v1 to v2 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. From e64f8579b712d66cedabcd3668d56cf60a1fe434 Mon Sep 17 00:00:00 2001 From: Alexander Gayko Date: Thu, 30 Oct 2025 14:55:29 +0100 Subject: [PATCH 2/5] Update patterns.md with empty property pattern details (#49385) * Update patterns.md with empty property pattern details Clarify the behavior of the empty property pattern in C#. * Add code example for empty property pattern Added a code example demonstrating the use of an empty property pattern with variable creation in C#. * Move sample to snippets. Per conversation on #49385 * Update docs/csharp/language-reference/operators/patterns.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> --- .../language-reference/operators/patterns.md | 4 ++++ .../snippets/patterns/PropertyPattern.cs | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/docs/csharp/language-reference/operators/patterns.md b/docs/csharp/language-reference/operators/patterns.md index 2299ac2518eff..0a9016daa7cc6 100644 --- a/docs/csharp/language-reference/operators/patterns.md +++ b/docs/csharp/language-reference/operators/patterns.md @@ -182,6 +182,10 @@ You can also add a run-time type check and a variable declaration to a property :::code language="csharp" source="snippets/patterns/PropertyPattern.cs" id="WithTypeCheck"::: +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`. + +:::code language="csharp" source="snippets/patterns/PropertyPattern.cs" id="EmptyPropertyPattern"::: + 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: :::code language="csharp" source="snippets/patterns/PropertyPattern.cs" id="RecursivePropertyPattern"::: diff --git a/docs/csharp/language-reference/operators/snippets/patterns/PropertyPattern.cs b/docs/csharp/language-reference/operators/snippets/patterns/PropertyPattern.cs index 1c1be24b28836..c6ec2e031b1be 100644 --- a/docs/csharp/language-reference/operators/snippets/patterns/PropertyPattern.cs +++ b/docs/csharp/language-reference/operators/snippets/patterns/PropertyPattern.cs @@ -5,8 +5,27 @@ public static class PropertyPattern public static void Examples() { WithTypeCheck(); + + // + if (GetSomeNullableStringValue() is { } nonNullValue) // Empty property pattern with variable creation + { + Console.WriteLine("NotNull:" + nonNullValue); + } + else + { + nonNullValue = "NullFallback"; // we can access the variable here. + Console.WriteLine("it was null, here's the fallback: " + nonNullValue); + } + // + } + private static string? GetSomeNullableStringValue() + { + // Simulate getting a nullable string value. + return DateTime.Now.Ticks % 2 == 0 ? "Hello, World!" : null; + } + // static bool IsConferenceDay(DateTime date) => date is { Year: 2020, Month: 5, Day: 19 or 20 or 21 }; // From 6982979694b7fc8d8489e63226b84dba0c51100c Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 30 Oct 2025 11:09:13 -0700 Subject: [PATCH 3/5] Update CA1806 with Pure methods (#49544) --- docs/fundamentals/code-analysis/quality-rules/ca1806.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1806.md b/docs/fundamentals/code-analysis/quality-rules/ca1806.md index cb34fc9d91d65..91163cad653d8 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca1806.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca1806.md @@ -1,7 +1,7 @@ --- title: "CA1806: Do not ignore method results (code analysis)" description: "Learn about code analysis rule CA1806: Do not ignore method results" -ms.date: 06/08/2022 +ms.date: 10/30/2025 f1_keywords: - CA1806 - DoNotIgnoreMethodResults @@ -32,6 +32,7 @@ There are several possible reasons for this warning: - A method that creates and returns a new string is called and the new string is never used. - A COM or P/Invoke method returns a `HRESULT` or error code that's never used. - A language-integrated query (LINQ) method returns a result that's never used. +- A `[Pure]` method is called and the return value is never used. ## Rule description @@ -41,7 +42,7 @@ Strings are immutable and methods such as are known to not have side effects, and the result should not be ignored. ## How to fix violations @@ -57,7 +58,7 @@ If method A calls method B but does not use the `HRESULT` or error code that the -or- -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. +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. ## When to suppress warnings @@ -122,7 +123,7 @@ The following example fixes the violation by assigning the result of [!NOTE] -> This violation cannot be reproduced in Visual Basic. +> This violation can't be reproduced in Visual Basic. :::code language="csharp" source="snippets/csharp/all-rules/ca1806.cs" id="snippet3"::: From 47867f78e211638f43652493cb6cbed327716a8b Mon Sep 17 00:00:00 2001 From: veerasai06 Date: Fri, 31 Oct 2025 00:06:08 +0530 Subject: [PATCH 4/5] =?UTF-8?q?Fix=20#49457=20=E2=80=93=20Update=20VB=20bu?= =?UTF-8?q?ild=20instructions=20to=20prefer=20dotnet=20build=20over=20vbc.?= =?UTF-8?q?exe=20(#49518)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add 'See also' link to dotnet build in VB compiler doc * Fix #49457 - Update VB build instructions to prefer dotnet build over vbc.exe * Fix link path typo in VB compiler doc * Fix link path for dotnet build in VB compiler doc * Fix relative link path for dotnet build reference * Fix markdown code block formatting to resolve OPS warning * Fix markdown code block formatting to resolve OPS warning * Fix markdown code block formatting to resolve OPS warning * Fix markdown code block formatting to resolve OPS warning * Fixed markdown formatting and duplicate code block issue in VB command-line compiler doc * Fixed markdown formatting and duplicate code block issue in VB command-line compiler doc * Move tip to top and add styled link to dotnet build * Move tip to top and add styled link to dotnet build * Remove extra blank lines from VB compiler doc --- .../command-line-compiler/fix-vb-docs-command | 0 ...how-to-invoke-the-command-line-compiler.md | 31 ++++++++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 docs/visual-basic/reference/command-line-compiler/fix-vb-docs-command diff --git a/docs/visual-basic/reference/command-line-compiler/fix-vb-docs-command b/docs/visual-basic/reference/command-line-compiler/fix-vb-docs-command new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/docs/visual-basic/reference/command-line-compiler/how-to-invoke-the-command-line-compiler.md b/docs/visual-basic/reference/command-line-compiler/how-to-invoke-the-command-line-compiler.md index 679dce09b79aa..c688e93701562 100644 --- a/docs/visual-basic/reference/command-line-compiler/how-to-invoke-the-command-line-compiler.md +++ b/docs/visual-basic/reference/command-line-compiler/how-to-invoke-the-command-line-compiler.md @@ -9,7 +9,11 @@ helpviewer_keywords: - "command line [Visual Basic], arguments" ms.assetid: 0fd9a8f6-f34e-4c35-a49d-9b9bbd8da4a9 --- -# How to: Invoke the Command-Line Compiler (Visual Basic) +# How to Invoke the Command-Line Compiler + +[!TIP] +For modern .NET projects, use the [`dotnet build`](../../../core/tools/dotnet-build.md) command to compile Visual Basic source files. +The `vbc.exe` command-line compiler is only used for older .NET Framework projects. 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. @@ -19,13 +23,18 @@ You can invoke the command-line compiler by typing the name of its executable fi 1. Open the Visual Studio Tools program folder within the Microsoft Visual Studio program group. -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. +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. + +3. Open the **Developer Command Prompt for Visual Studio**. -3. Invoke the Developer Command Prompt for Visual Studio. +4. At the command line, type `vbc.exe ` and then press **Enter**. -4. At the command line, type `vbc.exe` *sourceFileName* and then press ENTER. +For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type: - 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`. +```cmd +cd SourceFiles +vbc.exe Source.vb +``` ## To set the PATH environment variable to the compiler for the Windows Command Prompt @@ -43,17 +52,23 @@ You can invoke the command-line compiler by typing the name of its executable fi 6. Click **OK** to confirm your edits and close the dialog boxes. - 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. + 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. ## To invoke the compiler using the Windows Command Prompt 1. From the **Start** menu, click on the **Accessories** folder, and then open the **Windows Command Prompt**. -2. At the command line, type `vbc.exe`*sourceFileName* and then press ENTER. +2. At the command line, type `vbc.exe ` and then press **Enter**. + +For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type: - 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`. +```cmd +cd SourceFiles +vbc.exe Source.vb +``` ## See also - [Visual Basic Command-Line Compiler](index.md) - [Conditional Compilation](../../programming-guide/program-structure/conditional-compilation.md) +- [dotnet build](../../../core/tools/dotnet-build.md) — for modern .NET SDK usage From 5aad86d8d7e385236db3bb00a4587c27ea893b29 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Oct 2025 16:12:46 -0400 Subject: [PATCH 5/5] Fix errors in PR #49518: remove empty file, relocate TIP note, standardize list numbering (#49546) * Initial plan * Fix errors from PR #49518: delete empty file, move TIP note, fix list numbering 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> --- .../command-line-compiler/fix-vb-docs-command | 0 ...how-to-invoke-the-command-line-compiler.md | 22 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 docs/visual-basic/reference/command-line-compiler/fix-vb-docs-command diff --git a/docs/visual-basic/reference/command-line-compiler/fix-vb-docs-command b/docs/visual-basic/reference/command-line-compiler/fix-vb-docs-command deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/docs/visual-basic/reference/command-line-compiler/how-to-invoke-the-command-line-compiler.md b/docs/visual-basic/reference/command-line-compiler/how-to-invoke-the-command-line-compiler.md index c688e93701562..94789b287f87b 100644 --- a/docs/visual-basic/reference/command-line-compiler/how-to-invoke-the-command-line-compiler.md +++ b/docs/visual-basic/reference/command-line-compiler/how-to-invoke-the-command-line-compiler.md @@ -11,23 +11,23 @@ ms.assetid: 0fd9a8f6-f34e-4c35-a49d-9b9bbd8da4a9 --- # How to Invoke the Command-Line Compiler +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. + [!TIP] For modern .NET projects, use the [`dotnet build`](../../../core/tools/dotnet-build.md) command to compile Visual Basic source files. The `vbc.exe` command-line compiler is only used for older .NET Framework projects. -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. - [!INCLUDE[note_settings_general](~/includes/note-settings-general-md.md)] ## To invoke the compiler using the Developer Command Prompt for Visual Studio 1. Open the Visual Studio Tools program folder within the Microsoft Visual Studio program group. -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. +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. -3. Open the **Developer Command Prompt for Visual Studio**. +1. Open the **Developer Command Prompt for Visual Studio**. -4. At the command line, type `vbc.exe ` and then press **Enter**. +1. At the command line, type `vbc.exe ` and then press **Enter**. For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type: @@ -42,15 +42,15 @@ vbc.exe Source.vb 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). -2. From your **Start** Menu, right-click **My Computer**, and then click **Properties** from the shortcut menu. +1. From your **Start** Menu, right-click **My Computer**, and then click **Properties** from the shortcut menu. -3. Click the **Advanced** tab, and then click **Environment Variables**. +1. Click the **Advanced** tab, and then click **Environment Variables**. -4. In the **System** variables pane, select **Path** from the list and click **Edit**. +1. In the **System** variables pane, select **Path** from the list and click **Edit**. -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. +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. -6. Click **OK** to confirm your edits and close the dialog boxes. +1. Click **OK** to confirm your edits and close the dialog boxes. 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. @@ -58,7 +58,7 @@ vbc.exe Source.vb 1. From the **Start** menu, click on the **Accessories** folder, and then open the **Windows Command Prompt**. -2. At the command line, type `vbc.exe ` and then press **Enter**. +1. At the command line, type `vbc.exe ` and then press **Enter**. For example, if you stored your source code in a directory called `SourceFiles`, you would open the Command Prompt and type: