Skip to content

Commit b38d707

Browse files
author
Ron Petrusha
authored
What's New in .NET Core 2.2 (#9331)
* Began 2.2 revisions * Updated * Update dotnet-core-2-1.md * Update dotnet-core-2-2.md * Update index.md * Revised and fixed broken anchors * Addressed review comments * Addressed feedback * Added info about FDE (#1) * Added info about FDE * Update dotnet-core-2-2.md * Updated for FDEs * Corrected typoi
1 parent d27abf1 commit b38d707

File tree

2 files changed

+101
-2
lines changed

2 files changed

+101
-2
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: What's new in .NET Core 2.2
3+
description: Learn about the new features found in .NET Core 2.2.
4+
dev_langs:
5+
- "csharp"
6+
- "vb"
7+
author: rpetrusha
8+
ms.author: ronpet
9+
ms.date: 12/04/2018
10+
---
11+
# What's new in .NET Core 2.2
12+
13+
.NET Core 2.2 includes enhancements in application deployment, event handling for runtime services, authentication to Azure SQL databases, JIT compiler performance, and code injection prior to the execution of the `Main` method.
14+
15+
## New deployment mode
16+
17+
Starting with .NET Core 2.2, you can deploy [framework-dependent executables](../deploying/index.md#framework-dependent-executables-fde), which are **.exe** files instead of **.dll** files. Functionally similar to framework-dependent deployments, framework-dependent executables (FDE) still rely on the presence of a shared system-wide version of .NET Core to run. Your app contains only your code and any third-party dependencies. Unlike framework-dependent deployments, FDEs are platform-specific.
18+
19+
This new deployment mode has the distinct advantage of building an executable instead of a library, which means you can run your app directly without invoking `dotnet` first.
20+
21+
## Core
22+
23+
**Handling events in runtime services**
24+
25+
You may often want to monitor your application's use of runtime services, such as the GC, JIT, and ThreadPool, to understand how they impact your application. On Windows systems, this is commonly done by monitoring the ETW events of the current process. While this continues to work well, it's not always possible to use ETW if you're running in a low-privilege environment or on Linux or macOS. 
26+
27+
Starting with .NET Core 2.2, CoreCLR events can now be consumed using the <xref:System.Diagnostics.Tracing.EventListener?displayProperty=nameWithtype> class. These events describe the behavior of such runtime services as GC, JIT, ThreadPool, and interop. These are the same events that parts of the CoreCLR ETW provider.  This allows for applications to consume these events or use a transport mechanism to send them to a telemetry aggregation service. You can see how to subscribe to events in the following code sample:
28+
29+
```csharp
30+
internal sealed class SimpleEventListener : EventListener
31+
{
32+
// Called whenever an EventSource is created.
33+
protected override void OnEventSourceCreated(EventSource eventSource)
34+
{
35+
// Watch for the .NET runtime EventSource and enable all of its events.
36+
if (eventSource.Name.Equals("Microsoft-Windows-DotNETRuntime"))
37+
{
38+
EnableEvents(eventSource, EventLevel.Verbose, (EventKeywords)(-1));
39+
}
40+
}
41+
42+
// Called whenever an event is written.
43+
protected override void OnEventWritten(EventWrittenEventArgs eventData)
44+
{
45+
// Write the contents of the event to the console.
46+
Console.WriteLine($"ThreadID = {eventData.OSThreadId} ID = {eventData.EventId} Name = {eventData.EventName}");
47+
for (int i = 0; i < eventData.Payload.Count; i++)
48+
{
49+
string payloadString = eventData.Payload[i]?.ToString() ?? string.Empty;
50+
Console.WriteLine($"\tName = \"{eventData.PayloadNames[i]}\" Value = \"{payloadString}\"");
51+
}
52+
Console.WriteLine("\n");
53+
}
54+
}
55+
```
56+
57+
In addition, .NET Core 2.2 adds the following two properties to the <xref:System.Diagnostics.Tracing.EventWrittenEventArgs> class to provide additional information about ETW events:
58+
59+
- <xref:System.Diagnostics.Tracing.EventWrittenEventArgs.OSThreadId?displayProperty=nameWithType>
60+
61+
- <xref:System.Diagnostics.Tracing.EventWrittenEventArgs.TimeStamp?displayProperty=nameWithType>
62+
63+
## Data
64+
65+
**AAD authentication to Azure SQL databases with the SqlConnection.AccessToken property**
66+
67+
Starting with .NET Core 2.2, an access token issued by Azure Active Directory can be used to authenticate to an Azure SQL database. To support access tokens, the <xref:System.Data.SqlClient.SqlConnection.AccessToken> property has been added to the <xref:System.Data.SqlClient.SqlConnection> class. To take advantage of AAD authentication, download version 4.6 of the System.Data.SqlClient NuGet package. In order to use the feature, you can obtain the access token value using the [Active Directory Authentication Library for .NET](https://github.com/AzureAD/azure-activedirectory-library-for-dotnet) contained in the [`Microsoft.IdentityModel.Clients.ActiveDirectory`](https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory/) NuGet package.
68+
69+
## JIT compiler improvements
70+
71+
**Tiered compilation remains an opt-in feature**
72+
73+
In .NET Core 2.1, the JIT compiler implemented a new compiler technology, *tiered compilation*, as an opt-in feature. The goal of tiered compilation is improved performance. One of the important tasks performed by the JIT compiler is optimizing code execution. For little-used code paths, however, the compiler may spend more time optimizing code than the runtime spends executing unoptimized code. Tiered compilation introduces two stages in JIT compilation:
74+
75+
- A **first tier**, which generates code as quickly as possible.
76+
77+
- A **second tier**, which generates optimized code for those methods that are executed frequently. The second tier of compilation is performed in parallel for enhanced performance.
78+
79+
For information on the performance improvement that can result from tiered compilation, see [Announcing .NET Core 2.2 Preview 2](https://blogs.msdn.microsoft.com/dotnet/2018/09/12/announcing-net-core-2-2-preview-2/).
80+
81+
In .NET Core 2.2 Preview 2, tiered compilation was enabled by default. However, we've decided that we are still not ready to enable tiered compilation by default. So in .NET Core 2.2, tiered compilation continues to be an opt-in feature. For information on opting in to tiered compilation, see [Jit compiler improvements](dotnet-core-2-1.md#jit-compiler-improvements) in [What's new in .NET Core 2.1](dotnet-core-2-1.md).
82+
83+
## Runtime
84+
85+
**Injecting code prior to executing the Main method**
86+
87+
Starting with .NET Core 2.2, you can use a startup hook to inject code prior to running an application's Main method. Startup hooks make it possible for a host to customize the behavior of applications after they have been deployed without needing to recompile or change the application.
88+
89+
We expect hosting providers to define custom configuration and policy, including settings that potentially influence the load behavior of the main entry point, such as the <xref:System.Runtime.Loader.AssemblyLoadContext?displayProperty=nameWithType> behavior. The hook can be used to set up tracing or telemetry injection, to set up callbacks for handling, or to define other environment-dependent behavior. The hook is separate from the entry point, so that user code doesn't need to be modified.
90+
91+
See [Host startup hook](https://github.com/dotnet/core-setup/blob/master/Documentation/design-docs/host-startup-hook.md) for more information.
92+
93+
## See also
94+
95+
* [What's new in .NET Core](index.md)
96+
* [What's new in ASP.NET Core 2.2](/aspnet/core/release-notes/aspnetcore-2.2)
97+
* [New features in EF Core 2.2](/ef/core/what-is-new/ef-core-2.2)

docs/core/whats-new/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ title: What's new in .NET Core
33
description: Learn about the new features found in .NET Core.
44
author: rpetrusha
55
ms.author: ronpet
6-
ms.date: 05/07/2018
6+
ms.date: 12/04/2018
77
---
88
# What's new in .NET Core
99

1010
This page provides a summary of new features in each release of .NET Core starting with .NET Core 2.0. The following links provide detailed information on the major features added in each release.
1111

12+
- [.NET Core 2.2](dotnet-core-2-2.md)
13+
1214
- [.NET Core 2.1](dotnet-core-2-1.md)
1315

14-
- .[NET Core 2.0](dotnet-core-2-0.md)
16+
- [.NET Core 2.0](dotnet-core-2-0.md)
1517

1618
## See also
1719

0 commit comments

Comments
 (0)