Skip to content

Commit d73da10

Browse files
Merge pull request #10524 from MicrosoftDocs/main638690441363744634sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 52be5ed + cffe022 commit d73da10

File tree

6 files changed

+70
-31
lines changed

6 files changed

+70
-31
lines changed

docs/debugger/debugging-absolute-beginners.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Debugging code for absolute beginners"
33
description: "If you're debugging for the first time, learn a few principles to help you run your app in debugging mode with Visual Studio."
4-
ms.date: 10/19/2023
4+
ms.date: 12/5/2024
55
ms.topic: tutorial
66
helpviewer_keywords:
77
- "debugger"
@@ -309,7 +309,7 @@ Maffei 1, 11, ConsoleApp_FirstApp.GType
309309

310310
1. With the app still running, insert a breakpoint.
311311

312-
Right-click next to the `Console.WriteLine` method to get the context menu and select **Breakpoint** > **Insert Breakpoint** from the fly-out menu.
312+
In the `foreach` loop, right-click next to the `Console.WriteLine` method to get the context menu and select **Breakpoint** > **Insert Breakpoint** from the fly-out menu.
313313

314314
#### [C#](#tab/csharp)
315315

@@ -339,26 +339,36 @@ Maffei 1, 11, ConsoleApp_FirstApp.GType
339339

340340
1. Hover over the `GalaxyType` variable on the right, and then, to the left of the wrench icon, expand `theGalaxy.GalaxyType`. You see that `GalaxyType` contains a property `MyGType`, and the property value is set to `Spiral`.
341341

342-
:::image type="content" source="../debugger/media/beginners-inspect-variable.png" alt-text="Screenshot of the Visual Studio Debugger with a line of code in yellow and a menu open below the Galaxy GalaxyType property.":::
342+
:::image type="content" source="../debugger/media/beginners-inspect-variable.png" alt-text="Screenshot of the Visual Studio Debugger with a line of code in yellow and a menu open below the Galaxy GalaxyType property." lightbox="../debugger/media/beginners-inspect-variable.png":::
343343

344344
"Spiral" is actually the correct value you were expecting to print to the console! So it's a good start that you can access the value in this code while running the app. In this scenario, we're using the incorrect API. Let's see if you can fix this while running code in the debugger.
345345

346-
1. In the same code, while still debugging, put your cursor at the end of `theGalaxy.GalaxyType` and change it to `theGalaxy.GalaxyType.MyGType`. Although you can make the change, the code editor shows you an error indicating it can't compile this code. (In Visual Basic, the error isn't shown and this section of code works.)
346+
1. In the same code, while still debugging, put your cursor at the end of `theGalaxy.GalaxyType` and change it to `theGalaxy.GalaxyType.MyGType`. Although you can make the edit, the code editor shows you an error (red squiggly line). (In Visual Basic, the error isn't shown and this section of code works.)
347347

348348
1. Press **F11** (**Debug** > **Step Into** or the **Step Into** button in the Debug Toolbar) to execute the current line of code.
349349

350350
**F11** advances the debugger (and executes code) one statement at a time. **F10** (**Step Over**) is a similar command, and both are useful when learning how to use the debugger.
351351

352+
::: moniker range=">= vs-2022"
353+
354+
When you try to advance the debugger, the Hot Reload dialog box appears, indicating that edits can't be compiled.
355+
356+
:::image type="content" source="../debugger/media/vs-2022/beginners-edit.png" alt-text="Screenshot of the Visual Studio Debugger with a line of code highlighted in red and a message box with the Edit option selected.":::
357+
::: moniker-end
358+
359+
::: moniker range="<= vs-2019"
360+
352361
The Edit and Continue dialog box appears, indicating that edits can't be compiled.
353362

354-
:::image type="content" source="../debugger/media/beginners-edit.png" alt-text="Screenshot of the Visual Studio Debugger with a line of code highlighted in red and a message box with the Edit option selected.":::
363+
:::image type="content" source="../debugger/media/beginners-edit.png" alt-text="Screenshot of the Visual Studio Debugger with a line of code highlighted in red and a message box with the Edit option selected.":::
364+
::: moniker-end
355365

356366
> [!NOTE]
357367
> For debugging the Visual Basic example code, skip the next few steps until you're instructed to click the **Restart** :::image type="content" source="../debugger/media/dbg-tour-restart.png" alt-text="Icon showing Restart app button in Debug toolbar."::: button.
358368

359-
1. Select **Edit** in the **Edit and Continue** message box. You see an error message now in the **Error List** window. The error indicates that the `'object'` doesn't contain a definition for `MyGType`.
369+
1. Select **Edit** in the **Hot Reload** or **Edit and Continue** message box. You see an error message now in the **Error List** window. The error indicates that the `'object'` doesn't contain a definition for `MyGType`.
360370

361-
:::image type="content" source="../debugger/media/beginners-no-definition.png" alt-text="Screenshot of the Visual Studio Debugger with a line of code highlighted in red and an Error List window with two errors listed.":::
371+
:::image type="content" source="../debugger/media/beginners-no-definition.png" alt-text="Screenshot of the Visual Studio Debugger with a line of code highlighted in red and an Error List window with two errors listed." lightbox="../debugger/media/beginners-no-definition.png":::
362372

363373
Even though we set each galaxy with an object of type `GType` (which has the `MyGType` property), the debugger doesn't recognize the `theGalaxy` object as an object of type `GType`. What's going on? You want to look through any code that sets the galaxy type. When you do this, you see that the `GType` class definitely has a property of `MyGType`, but something isn't right. The error message about `object` turns out to be the clue; to the language interpreter, the type appears to be an object of type `object` instead of an object of type `GType`.
364374

33.8 KB
Loading

docs/debugger/remote-debugging-cpp.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Remote Debug a C++ Project"
33
description: Debug a Visual Studio C++ application from a remote computer, install and run remote tools, configure your project to connect, and deploy and run your app.
4-
ms.date: "03/20/2023"
4+
ms.date: "12/04/2024"
55
ms.topic: "conceptual"
66
dev_langs:
77
- "C++"
@@ -93,9 +93,9 @@ The remote debugger is supported on Windows 7 and newer and versions of Windows
9393
> [!TIP]
9494
> Alternatively, you can deploy the files as a separate step. In the **Solution Explorer,** right-click the project node and then choose **Deploy**.
9595
96-
If you have non-code files that are required by the application, you can specify them in a semicolon delimited list in **Additional Files to Deploy** on the **Remote Windows Debugger** page.
96+
If you have non-code files that are required by the application, you can specify them in a semicolon delimited list in **Additional Files to Deploy** on the **Debugger** properties page with **Remote Windows Debugger** selected.
9797

98-
Alternatively, you can include the files in your project, and set the **Content** property to **Yes** in the **Properties** page for each file. These files are copied to the **Deployment Directory** specified on the **Remote Windows Debugger** page. You can also change the **Item Type** to **Copy File** and specify additional properties there if you need the files to be copied to a subfolder of the **Deployment Directory**.
98+
Alternatively, you can include the files in your project, and set the **Content** property to **Yes** in the **Properties** page for each file. These files are copied to the **Deployment Directory** specified on the **Debugger** properties page with **Remote Windows Debugger** selected. You can also change the **Item Type** to **Copy File** and specify additional properties there if you need the files to be copied to a subfolder of the **Deployment Directory**.
9999

100100
## Set Up Debugging with Remote Symbols
101101

docs/test/run-a-unit-test-as-a-64-bit-process.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,50 @@
11
---
2-
title: Run a unit test as a 64-bit process
3-
description: Run unit tests and capture code coverage information as a 64-bit process, and recompile code or tests compiled as 32-bit/x86 to run them as a 64-bit process.
4-
ms.date: 03/10/2020
2+
title: Configure process architecture for unit tests
3+
description: Configure process architecture for unit tests and run unit tests and capture code coverage information as a 64-bit process, and recompile code or tests compiled as 32-bit/x86 to run them as a 64-bit process.
4+
ms.date: 12/4/2024
55
ms.topic: how-to
66
helpviewer_keywords:
7-
- unit tests, creating
8-
- unit tests, running
7+
- unit tests, process architecture
8+
- unit tests, 64-bit process
99
ms.author: mikejo
1010
manager: mijacobs
1111
ms.subservice: test-tools
1212
author: mikejo5000
1313
---
14-
# Run a unit test as a 64-bit process
14+
# Configure process architecture for a unit test
15+
16+
::: moniker range=">=vs-2022"
17+
This article provides information on the process architecture used for running unit tests, how to set the process architecture, and how to run unit tests as a 64-bit process.
18+
::: moniker-end
19+
20+
::: moniker range="<=vs-2019"
21+
This article provides information on how to set the process architecture for unit tests and how to run unit tests as a 64-bit process.
22+
::: moniker-end
23+
24+
::: moniker range=">=vs-2022"
25+
## Configure process architecture for MSTest projects
26+
27+
For MSTest projects using Visual Studio Testing Platform (VSTest) as the test runner, the default target platform (process architecture) matches the operating system's architecture. You can override this behavior for projects set to **Any CPU** as the target platform using either the Test Explorer **Settings**, as shown in the following illustration, or using the **Test** menu.
28+
29+
:::image type="content" source="../test/media/vs-2022/menu-process-architecture-for-anycpu.png" alt-text="Screenshot showing menu for selecting the processor architecture for AnyCPU." lightbox="../test/media/vs-2022/menu-process-architecture-for-anycpu.png":::
30+
31+
From the **Test** menu, select **Processor Architecture for AnyCPU Projects**.
32+
33+
For projects using MSTest as the test runner instead of VSTest, the architecture is determined strictly by MSBuild and runtime rules. Executables are generated based on the preferred architecture specified in MSBuild/runtime settings. You can adjust this preference using MSBuild properties (for example, **PreferNativeArm64**), but the setting **Processor Architecture for AnyCPU Projects** cannot be used to change the architecture for these projects.
34+
35+
> [!NOTE]
36+
> You can set the test runner when you create a unit test project using the MSTest project template, or by using MSBuild properties. For more information on the difference between MSTest and VSTest test runners, see [Microsoft.Testing.Platform and VSTest comparison](/dotnet/core/testing/unit-testing-platform-vs-vstest).
37+
38+
### PreferNativeArm64 (MSTest)
39+
40+
When using the `PreferNativeArm64` MSBuild property, the project prefers running natively on ARM64 architecture if it's available. This property is applicable to projects that generate executables and follow MSBuild runtime rules. This setting is ignored for Visual Studio Test Platform (VSTest) test runners and only applies to MSTest projects with MSTest configured as the test runner.
41+
::: moniker-end
42+
43+
## Run a unit test as a 64-bit process
1544

1645
If you have a 64-bit machine, you can run unit tests and capture code coverage information as a 64-bit process.
1746

18-
## To run a unit test as a 64-bit process
47+
To run a unit test as a 64-bit process:
1948

2049
1. If your code or tests were compiled as 32-bit/x86, but you now want to run them as a 64-bit process, recompile them as **Any CPU**.
2150

@@ -30,6 +59,11 @@ If you have a 64-bit machine, you can run unit tests and capture code coverage i
3059

3160
Specify `<TargetPlatform>x64</TargetPlatform>` in a *.runsettings* file. An advantage of this method is that you can specify groups of settings in different files and quickly switch between different settings. You can also copy settings between solutions. For more information, see [Configure unit tests by using a .runsettings file](../test/configure-unit-tests-by-using-a-dot-runsettings-file.md).
3261

62+
::: moniker range=">=vs-2022"
63+
> [!NOTE]
64+
> The **Processor Architecture for AnyCPU projects** setting is not supported in an MSTest project if you set MSTest as the test runner instead of VSTest.
65+
::: moniker-end
66+
3367
## Related content
3468

3569
- [Run unit tests with Test Explorer](../test/run-unit-tests-with-test-explorer.md)

docs/test/run-unit-tests-with-test-explorer.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Run unit tests with Test Explorer
33
description: Run tests with Test Explorer in Visual Studio, enable automatic tests after build, view results, group and filter the test list, create playlists, and use shortcuts.
4-
ms.date: 11/18/2024
4+
ms.date: 12/3/2024
55
ms.topic: how-to
66
author: mikejo5000
77
ms.author: mikejo
@@ -57,17 +57,8 @@ You can run all the tests in the solution, all the tests in a group, or a set of
5757

5858
- If individual tests have no dependencies that prevent them from being run in any order, turn on parallel test execution in the settings menu of the toolbar. This can noticeably reduce the time taken to run all the tests.
5959

60-
### Configure process architecture for AnyCPU (MSTest)
61-
62-
For MSTest projects using Visual Studio Testing Platform (vstest) as the test runner, the default architecture matches the operating system's architecture. You can override this behavior for AnyCPU projects through the Test Explorer menu shown in the image below.
63-
64-
:::image type="content" source="../test/media/vs-2022/menu-process-architecture-for-anycpu.png" alt-text="Screenshot showing menu for selecting the processor architecture for AnyCPU." lightbox="../test/media/vs-2022/menu-process-architecture-for-anycpu.png":::
65-
66-
For projects using MSTest as the test runner instead of Visual Studio Test Platform (vstest), the architecture is determined strictly by MSBuild and runtime rules. Executables are generated based on the preferred architecture specified in MSBuild/runtime settings. You can adjust this preference using MSBuild properties (e.g., **PreferNativeArm64**), but the Test Explorer menu **Processor Architecture for AnyCPU Projects** cannot be used to change the architecture for these projects.
67-
68-
#### PreferNativeArm64
69-
70-
When using this MSBuild property, the project will prefer running natively on ARM64 architecture if available. This property is applicable to projects that generate executables and follow MSBuild/runtime rules. It is important to note that this setting is ignored for Visual Studio Test Platform (vstest) test projects and only applies to MSTest projects with MSTest configured as the test runner.
60+
>![NOTE]
61+
> To configure the target platform (process architecture) for running unit tests, see [Configure process architecture for a unit test](../test/run-a-unit-test-as-a-64-bit-process.md).
7162
7263
### Run tests after every build
7364

docs/test/walkthrough-creating-and-running-unit-tests-for-managed-code.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Create, run, and customize C# unit tests
33
description: Learn how to create, run, and customize a series of unit tests using the Microsoft unit test framework for managed code and Visual Studio Test Explorer.
4-
ms.date: 11/18/2024
4+
ms.date: 12/3/2024
55
ms.topic: conceptual
66
helpviewer_keywords:
77
- unit tests, walkthrough
@@ -121,7 +121,7 @@ You now have a project with methods you can test. In this article, the tests foc
121121
> [!TIP]
122122
> You can also right-click on the solution in **Solution Explorer** and choose **Add** > **New Project**.
123123
124-
1. Type **test** in the search box, select **C#** as the language, and then select the C# **MSTest Unit Test Project** for .NET template, and then click **Next**.
124+
1. Type **test** in the search box, select **C#** as the language, and then select the C# **MSTest Test Project** for .NET template, and then click **Next**.
125125

126126
> [!NOTE]
127127
> In Visual Studio 2019 version 16.9, the MSTest project template is **Unit Test Project**.
@@ -130,6 +130,10 @@ You now have a project with methods you can test. In this article, the tests foc
130130

131131
1. Choose either the recommended target framework or .NET 8, and then choose **Create**.
132132

133+
::: moniker range=">=vs-2022"
134+
Starting in Visual Studio 2022 version 17.10, you can also select a test runner. For the test runner, you can choose either **VSTest** or **MSTest**. For more information on the difference between test runners, see [Microsoft.Testing.Platform and VSTest comparison](/dotnet/core/testing/unit-testing-platform-vs-vstest).
135+
::: moniker-end
136+
133137
The **BankTests** project is added to the **Bank** solution.
134138

135139
1. In the **BankTests** project, add a reference to the **Bank** project.

0 commit comments

Comments
 (0)