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
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 4 additions & 0 deletions docs/csharp/language-reference/operators/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -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":::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,27 @@ public static class PropertyPattern
public static void Examples()
{
WithTypeCheck();

// <EmptyPropertyPattern>
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);
}
// </EmptyPropertyPattern>

}

private static string? GetSomeNullableStringValue()
{
// Simulate getting a nullable string value.
return DateTime.Now.Ticks % 2 == 0 ? "Hello, World!" : null;
}

// <BasicExample>
static bool IsConferenceDay(DateTime date) => date is { Year: 2020, Month: 5, Day: 19 or 20 or 21 };
// </BasicExample>
Expand Down
9 changes: 5 additions & 4 deletions docs/fundamentals/code-analysis/quality-rules/ca1806.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

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

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

LINQ methods are known to not have side effects, and the result should not be ignored.
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.

## How to fix violations

Expand All @@ -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

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

> [!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":::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,66 @@ 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

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.

[!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.

1. Open the **Developer Command Prompt for Visual Studio**.

3. Invoke the Developer Command Prompt for Visual Studio.
1. At the command line, type `vbc.exe <sourceFileName>` 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

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

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.
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.
1. 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
```

## 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
Loading