Skip to content

Repo sync for protected branch #9792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Nov 11, 2023
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
33 changes: 28 additions & 5 deletions docs/data-tools/add-new-connections.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Connect to a database or open an MDF file in Visual Studio
ms.date: 11/09/2023
description: Connect to a database or data service with ADO.NET in Visual Studio, or connect to a database opened from a median disk file (.mdf).
ms.date: 03/07/2023
ms.topic: how-to
author: ghogen
ms.author: ghogen
Expand All @@ -12,8 +12,6 @@ ms.technology: vs-data-tools

[!INCLUDE [Visual Studio](~/includes/applies-to-version/vs-windows-only.md)]

[!INCLUDE [Data access tech note](./includes/data-technology-note.md)]

The steps in this article show how to connect to a data source in the Visual Studio IDE. The data source can be a local database, online data service, or a database opened from an `.mdf` file. You can work directly with your data in Visual Studio. You can execute queries, edit data, create and edit tables and other schema properties, edit stored procedures and functions, triggers, and so on. These functions are independent of the programming language or .NET version you are using.

## Server Explorer and SQL Server Object Explorer
Expand Down Expand Up @@ -58,14 +56,39 @@ To create a connection to the database, click the **Connect to database** icon i

This brings up the **Add Connection** dialog box. Here, we have entered the name of the SQL Server LocalDB instance, `(localdb)\MSSqlLocalDB`, which is usually installed with Visual Studio.

If you don't have access to another database, and you don't see LocalDB installed, you can install LocalDB through the Visual Studio Installer, as part of the **Data storage and processing** workload, the **ASP.NET and web development** workload, or as an individual component. See [Modify Visual Studio](../install/modify-visual-studio.md).

:::moniker range="<=vs-2019"
![Screenshot of Add New Connection dialog box.](../data-tools/media/add-new-connection-dialog.png)
:::moniker-end
:::moniker range=">=vs-2022"
![Screenshot of Add New Connection dialog box.](./media/vs-2022/add-new-connection.png)
![Screenshot of Add New Connection dialog box.](./media/vs-2022/add-new-connection-with-trust-selected.png)

In Visual Studio 2022 version 17.8 and later, the dialog includes two new options (**Encrypt** and **Trust Server Certificate**) that go into the connection string and affect the security settings used for your connection. These options support the stricter security features of the Microsoft.Data.SqlClient 4.0 database driver. See [Changes in encryption and certificate validation behavior](/sql/connect/ado-net/encryption-and-certificate-validation#changes-in-encryption-and-certificate-validation-behavior).

The recommended security practice is to use encryption and install a certificate on the server for it. See [Encryption and certificate validation](/sql/connect/ado-net/encryption-and-certificate-validation). To opt out of this enhanced security, set **Encrypt** to **Optional (False)**.

If you don't set **Encrypt** to optional with Visual Studio 17.8 or later, which use version 4.0 of the Microsoft.Data.SqlClient, then encryption defaults to mandatory. This is a breaking change from the behavior in earlier versions. If you don't have a valid certificate or don't choose **Trust Server Certificate**, you get the following error message:

> Encryption was enabled on this connection, review your SSL and certificate configuration for the target SQL Server, or enable 'Trust server certificate' in the connection dialog.
>
> **Additional information**
>
> A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.) (Microsoft SQL Server)

:::moniker-end

If you don't have access to another database, and you don't see LocalDB installed, you can install LocalDB through the Visual Studio Installer, as part of the **Data storage and processing** workload, the **ASP.NET and web development** workload, or as an individual component. See [Modify Visual Studio](../install/modify-visual-studio.md).
### Authentication types

You can choose from a variety of authentication types that cover a wide range of scenarios. For details, see [Authentication types](/sql/ssdt/connect-to-an-existing-database-in-sql-server-data-tools#AuthTypes).

:::moniker range=">=vs-2022"

In Visual Studio 17.8 and later, the names of the authentication options for SQL connections have been updated to reflect the name change from Active Directory to Microsoft Entra.

![Screenshot showing authentication types for Visual Studio 17.8 and later.](./media/vs-2022/authentication-options-microsoft-entra.png)

:::moniker-end

### MDF files

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/profiling/choose-performance-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The following table lists the different tools Visual Studio offers and provides

|Performance Tool|Description|When to use the tool?|
|----------------------|---------------------|-------------|-------------|
|[CPU Usage](../profiling/beginners-guide-to-performance-profiling.md)|Shows where the CPU is spending time.|&#x2022; Begin an investigation for general performance issues.</br>&#x2022; Investigate high Server CPU usage.</br>&#x2022; Investigate DevOps scenarios, such as when orders are not getting through to the retail website.</br>&#x2022; Optimize CPU usage.</br>&#x2022; Investigate latency in API calls.|
|[CPU Usage](../profiling/beginners-guide-to-performance-profiling.md)|Shows where the CPU is spending time.|&#x2022; Begin an investigation for general performance issues.</br>&#x2022; Investigate high server CPU usage.</br>&#x2022; Investigate DevOps scenarios, such as when orders are not getting through to the retail website.</br>&#x2022; Optimize CPU usage.</br>&#x2022; Investigate latency in API calls.|
|[Flame graph](../profiling/flame-graph.md)|View within the CPU Usage tool that provides an alternate visualization of the call tree.|Investigate latency in API calls|
|[Hot path](../profiling/cpu-insights.md)|View within the CPU Usage tool that shows where most of the CPU time was spent in your application.|Investigate latency in API calls|
|[PerfTips](../profiling/perftips.md)|Shows a quick measurement of performance information while interacting with your code.|While debugging, you want to see the elapsed time between the previous step operation (or breakpoint) to the current step or breakpoint.|
Expand Down
2 changes: 1 addition & 1 deletion docs/profiling/dotnet-counters-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ manager: AndSter
The .NET Counters tool allows you to visualize [dotnet counters](/dotnet/core/diagnostics/dotnet-counters) over time right from within the Visual Studio profiler.

> [!NOTE]
> The .NET Counters tool requires Visual Studio 2019 version 16.7 or later and targets .NET Core 3.0+.
> The .NET Counters tool requires Visual Studio 2019 version 16.7 or later and targets .NET Core 3.0+ and .NET 5+.

## Setup

Expand Down
8 changes: 4 additions & 4 deletions docs/profiling/instrumentation-overview.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Instrumentation"
description: Learn about the tools you can use to instrument your applications.
ms.date: "03/31/2023"
ms.date: "11/09/2023"
ms.topic: "conceptual"
author: "mikejo5000"
ms.author: "mikejo"
Expand Down Expand Up @@ -35,9 +35,9 @@ When it comes to profiling, there's two mechanisms of collecting data. Collectio

::: moniker range=">=vs-2022"

**Instrumentation** - Starting in Visual Studio 2022 version 17.5, the Instrumentation tool provides dynamic instrumentation for .NET Core, .NET 5+, and .NET Framework. This tool provides the best performance for instrumentation scenarios. Access this tool using the Performance Profiler (Alt + F2). For more information, see [Instrument your application](../profiling/instrumentation.md). For DLLs, you need to use the command-line tool (VSInstr) instead.
**Instrumentation** - Starting in Visual Studio 2022 version 17.5, the Instrumentation tool provides dynamic instrumentation for .NET Core, .NET 5+, and .NET Framework. This tool provides the best performance for instrumentation scenarios. Access this tool using the Performance Profiler (Alt + F2). For more information, see [Instrument your application](../profiling/instrumentation.md).

Starting in Visual Studio 2022 version 17.6 Preview 2, the Instrumentation tool also supports C/C++, but uses static instrumentation (VSInstr).
Starting in Visual Studio 2022 version 17.6, the Instrumentation tool also supports C/C++, but uses static instrumentation (VSInstr).

To use this tool from the command-line, see [Profiling apps from the command-line](../profiling/profile-apps-from-command-line.md).
::: moniker-end
Expand All @@ -49,7 +49,7 @@ To use this tool from the command-line, see [Profiling apps from the command-lin

## Static instrumentation tool

**VSInstr** - Starting in Visual Studio 2022 version 17.6 Preview 2, the [Instrumentation tool](../profiling/instrumentation.md) uses VSInstr for C/C++ support. VSInstr is also used for command-line scenarios and works for .NET Framework, .NET 5+, and C/C++ apps. For instrumenting DLLs, the command-line tool is the only option. For more information, see [Collect detailed timing data for a stand-alone application by using the profiler command line](../profiling/collecting-detailed-timing-data-for-a-stand-alone-application.md).
**VSInstr** - Starting in Visual Studio 2022 version 17.6 Preview 2, the [Instrumentation tool](../profiling/instrumentation.md) uses VSInstr for C/C++ support. VSInstr is also used for command-line scenarios and works for .NET Framework and C/C++ apps. For more information, see [Collect detailed timing data for a stand-alone application by using the profiler command line](../profiling/collecting-detailed-timing-data-for-a-stand-alone-application.md).

## See Also

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/profiling/media/vs-2022/prof-tour-diagnostic-tools.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 14 additions & 2 deletions docs/profiling/profiling-feature-tour.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "First look at profiling tools"
description: "Take a brief look at the different diagnostic tools available in Visual Studio."
ms.date: 04/24/2023
ms.date: 11/09/2023
ms.topic: conceptual
f1_keywords:
- vs.diagnosticshub.overview
Expand Down Expand Up @@ -38,12 +38,14 @@ The profiling tools that you can access during a debugging session are available

::: moniker range=">=vs-2022"
![Diagnostic Tools window](../profiling/media/vs-2022/prof-tour-diagnostic-tools.png "Diagnostic Tools")

While you are debugging, you can use the **Diagnostic Tools** window to analyze CPU, memory usage, .NET counters, and you can view events that show performance-related information.
::: moniker-end
::: moniker range="<=vs-2019"
![Diagnostic Tools window](../profiling/media/prof-tour-diagnostic-tools.png "Diagnostic Tools")
::: moniker-end

While you are debugging, you can use the **Diagnostic Tools** window to analyze CPU and memory usage, and you can view events that show performance-related information.
::: moniker-end

::: moniker range=">=vs-2022"
![Diagnostic Tools Summary view](../profiling/media/vs-2022/prof-tour-cpu-and-memory-graph.png "Diagnostic Tools Summary")
Expand All @@ -55,9 +57,18 @@ While you are debugging, you can use the **Diagnostic Tools** window to analyze
The **Diagnostic Tools** window is a common way to profile apps, but for Release builds you can also do a post-mortem analysis of your app instead. For more information on different approaches, see [Run profiling tools with or without the debugger](../profiling/running-profiling-tools-with-or-without-the-debugger.md). To see profiling tool support for different app types, see [Which tool should I use?](../profiling/choose-performance-tool.md).

Tools available in the Diagnostic Tools window or during a debugging session include:
::: moniker range=">=vs-2022"

- [CPU usage](../profiling/beginners-guide-to-performance-profiling.md)
- [Memory usage](../profiling/memory-usage.md)
- [.NET Counters](../profiling/dotnet-counters-tool.md)
- [PerfTips](../profiling/perftips.md)
::: moniker-end
::: moniker range="<=vs-2019"
- [CPU usage](../profiling/beginners-guide-to-performance-profiling.md)
- [Memory usage](../profiling/memory-usage.md)
- [PerfTips](../profiling/perftips.md)
::: moniker-end

> [!TIP]
> Use relaunch to skip the launch page and automatically run with your previous settings by pressing **Alt+F2** or by clicking **Debug > Performance Profiler**.
Expand Down Expand Up @@ -254,6 +265,7 @@ Starting in Visual Studio 2019 version 16.7, you can use the [.NET Counters tool
The tool shows live values for each counter in a list view.

:::image type="content" source="../profiling/media/dotnet-counters-tool-collecting.png" alt-text=".NET Counter tool collecting.":::

## Analyze resource consumption (XAML)

In XAML apps, such as Windows desktop WPF apps and UWP apps, you can analyze resource consumption using the Application Timeline tool. For example, you can analyze the time spent by your application preparing UI frames (layout and render), servicing network and disk requests, and in scenarios like application startup, page load, and Window resize. To use the tool, choose **Application Timeline** in the Performance Profiler, and then choose **Start**. In your app, go through the scenario with a suspected resource consumption issue, and then choose **Stop collection** to generate the report.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Run profiling tools with or without the debugger"
description: "Learn about differences between the different modes available for profiling tools"
ms.date: "03/22/2023"
ms.date: "11/09/2023"
ms.topic: "conceptual"
author: "mikejo5000"
ms.author: "mikejo"
Expand All @@ -26,16 +26,24 @@ To decide which tools and results to use, consider the following options:
- The debugger itself changes performance times, as it does necessary debugger operations like intercepting exception and module load events.
- Release build performance numbers in the Performance Profiler are the most precise and accurate. Debugger-integrated tool results are most useful to compare with other debugging-related measurements, or to use debugger features.
- Some tools, such as the .NET Object Allocation tool, are only available for non-debugger scenarios.

- Debug vs. release build
- For problems caused by CPU-intensive calls, there might be considerable performance differences between release and debug builds. Check to see whether the issue exists in release builds.
- If the problem occurs only during debug builds, you probably don't need to run the non-debugger tools. For release build problems, decide whether features provided by the debugger-integrated tools will help to pinpoint the problem.
- Release builds provide optimizations like inlining function calls and constants, pruning unused code paths, and storing variables in ways that can't be used by the debugger. Performance numbers in the debug builds are less accurate, because debug builds lack these optimizations.

## <a name="BKMK_Quick_start__Collect_diagnostic_data"></a> Collect profiling data while debugging

::: moniker range=">=vs-2022"
When you start debugging in Visual Studio by selecting **Debug** > **Start Debugging**, or pressing **F5**, the **Diagnostic Tools** window appears by default. To open it manually, select **Debug** > **Windows** > **Show Diagnostic Tools**. The **Diagnostic Tools** window shows information about events, process memory, CPU usage, and .NET Counters.

![Screenshot of the Diagnostic Tools window.](../profiling/media/vs-2022/diagnostic-tools-window.png "Diagnostic Tools Window")
::: moniker-end
::: moniker range="<=vs-2019"
When you start debugging in Visual Studio by selecting **Debug** > **Start Debugging**, or pressing **F5**, the **Diagnostic Tools** window appears by default. To open it manually, select **Debug** > **Windows** > **Show Diagnostic Tools**. The **Diagnostic Tools** window shows information about events, process memory, and CPU usage.

![Screenshot of the Diagnostic Tools window](../profiling/media/diagnostictoolswindow.png "Diagnostic Tools Window")
::: moniker-end

- Use the **Settings** icon in the toolbar to select whether to view **Memory Usage**, **UI Analysis**, and **CPU Usage**.

Expand All @@ -59,11 +67,23 @@ During a debugging session, the Events tab of the Diagnostic Tools window lists

Use the **Filter** drop-down list to filter events in and out of view, by selecting or clearing specific categories of events.

::: moniker range=">=vs-2022"
![Screenshot of Diagnostic Event filter.](../profiling/media/vs-2022/diagnostic-event-filter.png "Diagnostic Event Filter")
::: moniker-end
::: moniker range="<=vs-2019"
![Screenshot of Diagnostic Event filter](../profiling/media/diagnosticeventfilter.png "Diagnostic Event Filter")
::: moniker-end

::: moniker range=">=vs-2022"
Use the search box to find a specific string in the event list. Here are the results of a search for the file name *model* that matched three events:

![Screenshot of Diagnostic Event search.](../profiling/media/vs-2022/diagnostics-event-search.png "Diagnostic Event Search")
::: moniker-end
::: moniker range="<=vs-2019"
Use the search box to find a specific string in the event list. Here are the results of a search for the string *name* that matched four events:

![Screenshot of Diagnostic Event search](../profiling/media/diagnosticseventsearch.png "Diagnostic Event Search")
::: moniker-end

For more information, see [Searching and filtering the Events tab of the Diagnostic Tools window](https://devblogs.microsoft.com/devops/searching-and-filtering-the-events-tab-of-the-diagnostic-tools-window/).

Expand All @@ -77,21 +97,36 @@ To collect performance data without debugging, you can run the Performance Profi

1. On the diagnostic tools launch page, select one or more tools to run. Only the tools that are applicable to the project type, operating system, and programming language are shown. Select **Show all tools** to also see tools that are disabled for this diagnostic session.

::: moniker range=">=vs-2022"
![Screenshot of diagnostic tools.](../profiling/media/vs-2022/performance-profiler-summary-page.png "DIAG_SelectTool")
::: moniker-end
::: moniker range="<=vs-2019"
![Screenshot of diagnostic tools](../profiling/media/diaghubsummarypage.png "DIAG_SelectTool")
::: moniker-end

1. To start the diagnostic session, select **Start**.

While the session is running, some tools show graphs of real-time data on the diagnostic tools page, and controls to pause and resume data collection.
While the session is running, some tools show graphs of real-time data on the diagnostic tools page, and might show options to pause and resume data collection.

![Screenshot of data collection on the Performance Profiler](../profiling/media/diaghubcollectdata.png "Hub collect data")
::: moniker range=">=vs-2022"
![Screenshot of data collection on the Performance Profiler.](../profiling/media/vs-2022/performance-profiler-collect-data.png "Diag collect data")
::: moniker-end
::: moniker range="<=vs-2019"
![Screenshot of data collection on the Performance Profiler](../profiling/media/diaghubcollectdata.png "Hub collect data")
::: moniker-end

1. To end the diagnostic session, select **Stop Collection**.

The analyzed data appears on the **Report** page.

You can save the reports, and open them from the **Recently Opened Sessions** list on the Diagnostic Tools launch page.

::: moniker range=">=vs-2022"
![Screenshot of Diagnostic Tools Recently Opened Sessions list.](../profiling/media/vs-2022/performance-profiler-open-existing-diagnostics-session.png "PDHUB_OpenExistingDiagSession")
::: moniker-end
::: moniker range="<=vs-2019"
![Screenshot of Diagnostic Tools Recently Opened Sessions list](../profiling/media/diaghubopenexistingdiagsession.png "PDHUB_OpenExistingDiagSession")
::: moniker-end

For more information, see:

Expand Down