You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/code-quality/C26403.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Owner pointers are like unique pointers: they own a resource exclusively, and ma
21
21
For more information, see the [C++ Core Guidelines](http://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#r-resource-management).
22
22
23
23
## Remarks
24
-
- Currently (Visual Studio 2017 version 15.3) this check doesn’t give the exact path which fails to release the resource. This behavior may be imporved in future releases. It may be difficult to find exact location for a fix. The better approach is to try to replace plain pointers in complex functions with unique pointers to avoid any risks.
24
+
- Currently (Visual Studio 2017 version 15.3) this check doesn’t give the exact path which fails to release the resource. This behavior may be improved in future releases. It may be difficult to find exact location for a fix. The better approach is to try to replace plain pointers in complex functions with unique pointers to avoid any risks.
25
25
26
26
- The check may discard an over-complicated function in order to not block code analysis. Generally, the complexity of functions should be maintained under some reasonable threshold. We may consider adding a local complexity check to the C++ Core Guidelines module if there is clear demand for it. This limitation is applicable to other rules which are sensitive to data flow.
Copy file name to clipboardExpand all lines: docs/debugger/how-to-debug-managed-and-native-code.md
+23-18Lines changed: 23 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Tutorial: Debug managed and native code (mixed mode)"
3
3
description: Learn how to debug a native DLL from a .NET Core or .NET Framework app using mixed mode debugging
4
4
ms.custom: ""
5
-
ms.date: "04/27/2018"
5
+
ms.date: "10/24/2018"
6
6
ms.technology: "vs-ide-debug"
7
7
ms.topic: "tutorial"
8
8
dev_langs:
@@ -17,7 +17,7 @@ ms.workload:
17
17
- "dotnet"
18
18
- "cplusplus"
19
19
---
20
-
# Tutorial: Debug managed and native code in Visual Studio
20
+
# Tutorial: Debug managed and native code in the same debugging session
21
21
22
22
Visual Studio allows you to enable more than one debugger type when debugging, which is called mixed mode debugging. In this tutorial, you set options to debug both managed and native code in a single debugging session. This tutorial shows how to debug native code from a managed app, but you can also do the reverse, and [debug managed code from a native app](../debugger/how-to-debug-in-mixed-mode.md). The debugger also supports other types of mixed mode debugging, such as debugging [Python and native code](../python/debugging-mixed-mode-c-cpp-python-in-visual-studio.md) and using the script debugger in app types such as ASP.NET.
23
23
@@ -36,34 +36,34 @@ In this tutorial, you will:
36
36
37
37
If you haven't already installed Visual Studio, go to the [Visual Studio downloads](https://visualstudio.microsoft.com/downloads/?utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=button+cta&utm_content=download+vs2017) page to install it for free.
38
38
39
-
If you need to install the workload but already have Visual Studio, click the **Open Visual Studio Installer** link in the left pane of the **New Project** dialog box. The Visual Studio Installer launches. Choose the **Node.js development** workload, then choose **Modify**.
39
+
If you need to install the workload but already have Visual Studio, click the **Open Visual Studio Installer** link in the left pane of the **New Project** dialog box. The Visual Studio Installer launches. Choose the **Desktop development with C++** workload, then choose **Modify**.
40
40
41
41
* You must also have either the **.NET desktop development** workload or the **.NET Core cross platform development** workload installed, depending on which app type you want to create.
42
42
43
43
## Create a simple native DLL
44
44
45
45
1. In Visual Studio, choose **File** > **New** > **Project**.
46
46
47
-
1. In the **New Project** dialog box, choose **Visual C++**, **General** from the installed templates section, and then in the middle pane select **Empty Project**.
47
+
1. In the **New Project** dialog box, choose **Visual C++**, **Other** from the installed templates section, and then in the middle pane select **Empty Project**.
48
48
49
-
1. In the **Name** field, type **Mixed-Mode-Debugging** and click **OK**.
49
+
1. In the **Name** field, type **Mixed_Mode_Debugging** and click **OK**.
50
50
51
51
Visual Studio creates the empty project, which appears in Solution Explorer in the right pane.
52
52
53
-
1. In Solution Explorer, right-click the **Source Files** node in the C++ project, and then choose **Add** > **New Item**, and then select **C++ file (.cpp)**. Give the file the name **Mixed-Mode.cpp**, and choose **Add**.
53
+
1. In Solution Explorer, right-click the **Source Files** node in the C++ project, and then choose **Add** > **New Item**, and then select **C++ file (.cpp)**. Give the file the name **Mixed_Mode.cpp**, and choose **Add**.
54
54
55
55
Visual Studio adds the new C++ file.
56
56
57
-
1. Copy the following code into *Mixed-Mode.cpp*:
57
+
1. Copy the following code into *Mixed_Mode.cpp*:
58
58
59
59
```cpp
60
60
#include"Mixed_Mode.h"
61
61
```
62
-
1. In Solution Explorer, right-click the **Header Files** node in the C++ project, and then choose **Add** > **New Item**, and then select **Header file (.h)**. Give the file the name **Mixed-Mode.h**, and choose **Add**.
62
+
1. In Solution Explorer, right-click the **Header Files** node in the C++ project, and then choose **Add** > **New Item**, and then select **Header file (.h)**. Give the file the name **Mixed_Mode.h**, and choose **Add**.
63
63
64
64
Visual Studio adds the new header file.
65
65
66
-
1. Copy the following code into *Mixed-Mode.h*:
66
+
1. Copy the following code into *Mixed_Mode.h*:
67
67
68
68
```cpp
69
69
#ifndef MIXED_MODE_MULTIPLY_HPP
@@ -78,27 +78,30 @@ In this tutorial, you will:
78
78
#endif
79
79
```
80
80
81
-
1. From the Debug toolbar, select a **Debug** configuration and **Any CPU** as the platform, or, for .NET Core, select **x64** as the platform.
81
+
1. From the Debug toolbar, select a **Debug** configuration and **x86** or **x64** as the platform (for .NET Core, which always runs in 64-bit mode, select **x64** as the platform).
82
82
83
-
> [!NOTE]
84
-
> On .NET Core, choose **x64** as the platform. .NET Core always runs in 64-bit mode so this is required.
83
+
1. In Solution Explorer, right-click the project node (**Mixed_Mode_Debugging**) and choose **Properties**.
85
84
86
-
1. In Solution Explorer, right-click the project node (**Mixed-Mode-Debugging**) and choose **Properties**.
85
+
> [!IMPORTANT]
86
+
> Property configuration for C++ is per-platform. So, if you switch from one to the other (x86 to x64 or vice versa), you must also set the properties for the new configuration. (In the Properties page, verify either **x64** or **Win32** is set as the platform at the top of the page.)
87
87
88
-
1. In the **Properties** page, choose **Configuration Properties** > **Linker** > **Advanced**, and then in the **No Entry Point** drop-down list, select **NO**. Then apply settings.
88
+
1. In the **Properties** page, choose **Configuration Properties** > **Linker** > **Advanced**, and then in the **No Entry Point** drop-down list, make sure that **No** is selected. If you need to change the setting to **No**, then choose **Apply**.
89
89
90
90
1. In the **Properties** page, choose **Configuration Properties** > **General**, and then select **Dynamic Library (.dll)** from the **Configuration Type** field. Then apply settings.
91
91
92
92

93
93
94
-
1. Right-click the project and choose **Debug** > **Build**.
94
+
1. Right-click the project and choose **Build**.
95
95
96
96
The project should build with no errors.
97
97
98
98
## Create a simple .NET Framework or .NET Core app to call the DLL
99
99
100
100
1. In Visual Studio, choose **File** > **New** > **Project**.
101
101
102
+
> [!NOTE]
103
+
> Although you can also add the new managed project to the solution with the C++ project, instead of creating a new solution, we are not doing that here to support a larger set of debugging scenarios.
104
+
102
105
1. Choose a template for your application code.
103
106
104
107
For .NET Framework, in the **New Project** dialog box, choose **Visual C#**, **Windows Desktop** from the installed templates section, and then in the middle pane select **Console App (.NET Framework)**.
@@ -122,9 +125,9 @@ In this tutorial, you will:
122
125
// Replace the file path shown here with the
123
126
// file path on your computer. For .NET Core, the typical (default) path
0 commit comments