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/core/diagnostics/eventsource-collect-and-view-traces.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -272,3 +272,34 @@ this isn't required. Following is an example `EventListener` implementation that
272
272
3/24/2022 9:23:35 AM RequestStart
273
273
3/24/2022 9:23:35 AM RequestStop
274
274
```
275
+
276
+
> [!WARNING]
277
+
> Potential Pitfalls when implementing EventSource Callbacks via EventListener include deadlocks, infinite recursions, and uninitialized types.
278
+
>
279
+
> EventSource instances are initialized early in the runtime, before some core features are fully initialized. As a result, acquiring locks inside an EventSource callback like <xref:System.Diagnostics.Tracing.EventListener.OnEventWritten%2A> when the thread normally would not have done so may cause deadlocks.
280
+
>
281
+
> To mitigate this risk, consider the following precautions:
282
+
>
283
+
> -**Use Queues to Defer Work**: There are a variety of APIs you might want to call in OnEventWritten() that do non-trivial work, for example File IO, Console, or Http. For most events, these APIs work fine, but if you tried to call Console.WriteLine() in an event handler during the initialization of the Console class then it would probably fail. If you don't know whether a given event handler occurs at a time when APIs are safe to call, consider adding some information about the event to an in-memory queue instead. Then, on a separate thread, process items in the queue.
284
+
> -**Minimize Lock Duration**: Ensure that any locks acquired within the callback are not held for extended periods.
285
+
> -**Use Non-blocking APIs**: Prefer using non-blocking APIs within the callback to avoid potential deadlocks.
286
+
> -**Implement a Re-entrancy Guard**: Use a re-entrancy guard to prevent infinite recursion. For example:
Copy file name to clipboardExpand all lines: docs/core/extensions/options.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ ms.date: 08/13/2024
8
8
9
9
# Options pattern in .NET
10
10
11
-
The options pattern uses classes to provide strongly-typed access to groups of related settings. When [configuration settings](configuration.md) are isolated by scenario into separate classes, the app adheres to two important software engineering principles:
11
+
The options pattern uses classes to provide stronglytyped access to groups of related settings. When [configuration settings](configuration.md) are isolated by scenario into separate classes, the app adheres to two important software engineering principles:
12
12
13
13
- The [Interface Segregation Principle (ISP) or Encapsulation](../../architecture/modern-web-apps-azure/architectural-principles.md#encapsulation): Scenarios (classes) that depend on configuration settings depend only on the configuration settings that they use.
14
14
-[Separation of Concerns](../../architecture/modern-web-apps-azure/architectural-principles.md#separation-of-concerns): Settings for different parts of the app aren't dependent or coupled with one another.
Copy file name to clipboardExpand all lines: docs/core/runtime-config/index.md
+11-19Lines changed: 11 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,29 +4,21 @@ description: Learn how to configure the .NET runtime using configuration setting
4
4
ms.topic: conceptual
5
5
ms.date: 07/23/2021
6
6
---
7
-
# .NET Runtime configuration settings
8
-
9
-
.NET 5+ (including .NET Core versions) supports the use of configuration files and environment variables to configure the behavior of .NET applications.
10
-
11
-
> [!NOTE]
12
-
> The articles in this section concern configuration of the .NET Runtime itself. If you're migrating an app from .NET Framework to .NET and are looking for a replacement for the *app.config* file, or if you simply want a way to use custom configuration values in your .NET app, see the <xref:Microsoft.Extensions.Configuration.ConfigurationBuilder?displayProperty=fullName> class and [Configuration in .NET](../extensions/configuration.md).
13
-
14
-
Using these settings is an attractive option if:
15
-
16
-
- You don't own or control the source code for an application and therefore are unable to configure it programmatically.
17
-
- Multiple instances of your application run at the same time on a single system, and you want to configure each for optimum performance.
7
+
# .NET runtime configuration settings
18
8
19
9
.NET provides the following mechanisms for configuring behavior of the .NET runtime:
20
10
21
-
- The [runtimeconfig.json file](#runtimeconfigjson)
22
-
-[MSBuild properties](#msbuild-properties)
23
-
-[Environment variables](#environment-variables)
24
-
25
-
> [!TIP]
26
-
> Configuring an option by using an environment variable applies the setting to all .NET apps. Configuring an option in the *runtimeconfig.json* or project file applies the setting to that application only.
| The [runtimeconfig.json file](#runtimeconfigjson)| Applies the setting to a specific app. Use this file if multiple instances of your app run at the same time on a single system, and you want to configure each for optimum performance. |
14
+
|[MSBuild properties](#msbuild-properties)| Applies the setting to a specific app. MSBuild properties take precedence over settings in *runtimeconfig.json*. |
15
+
|[Environment variables](#environment-variables)| Applies the setting to all .NET apps. |
27
16
28
17
Some configuration values can also be set programmatically by calling the <xref:System.AppContext.SetSwitch%2A?displayProperty=nameWithType> method.
29
18
19
+
> [!NOTE]
20
+
> The articles in this section concern configuration of the .NET runtime itself. If you're migrating an app from .NET Framework to .NET and are looking for a replacement for the *app.config* file, see [Modernize after upgrading to .NET](../porting/modernize.md#appconfig). For information about supplying custom configuration values to .NET apps, see [Configuration in .NET](../extensions/configuration.md).
21
+
30
22
The articles in this section of the documentation are organized by category, for example, [debugging](debugging-profiling.md) and [garbage collection](garbage-collector.md). Where applicable, configuration options are shown for *runtimeconfig.json* files, MSBuild properties, environment variables, and, for cross-reference, *app.config* files for .NET Framework projects.
31
23
32
24
## runtimeconfig.json
@@ -49,7 +41,7 @@ Specify runtime configuration options in the **configProperties** section of the
49
41
50
42
### Example [appname].runtimeconfig.json file
51
43
52
-
If you're placing the options in the output JSON file, nest them under the `runtimeOptions` property.
44
+
If you're placing the options in the *output* JSON file, nest them under the `runtimeOptions` property.
53
45
54
46
```json
55
47
{
@@ -72,7 +64,7 @@ If you're placing the options in the output JSON file, nest them under the `runt
72
64
73
65
### Example runtimeconfig.template.json file
74
66
75
-
If you're placing the options in the template JSON file, omit the `runtimeOptions` property.
67
+
If you're placing the options in the *template* JSON file, **omit** the `runtimeOptions` property.
Copy file name to clipboardExpand all lines: docs/core/whats-new/dotnet-9/overview.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,26 @@ C# 13 ships with the .NET 9 SDK and includes the following new features:
90
90
91
91
For more information, see [What's new in C# 13](../../../csharp/whats-new/csharp-13.md).
92
92
93
+
## F# 9
94
+
95
+
F# 9 ships with the .NET 9 SDK and includes the following new features:
96
+
97
+
- Nullable reference types
98
+
- Discriminated union .Is* properties
99
+
- Partial active patterns can return bool instead of unit option
100
+
- Prefer extension methods to intrinsic properties when arguments are provided
101
+
- Empty-bodied computation expressions
102
+
- Hash directives are allowed to take non-string arguments
103
+
- Extended #help directive in fsi to show documentation in the read-eval-print loop (REPL)
104
+
- Allow #nowarn to support the FS prefix on error codes to disable warnings
105
+
- Warning about TailCall attribute on non-recursive functions or let-bound values
106
+
- Enforce attribute targets
107
+
- Random functions for collections
108
+
- C# collection expression support for F# lists and sets
109
+
- Various developer productivity, performance and tooling improvements
110
+
111
+
For more information, see [What's new in F# 9](../../../fsharp/whats-new/fsharp-9.md).
112
+
93
113
## Windows Presentation Foundation
94
114
95
115
Windows Presentation Foundation (WPF) includes support for Windows 11 theming and hyphen-based ligatures. For more information, see [WPF in .NET 9 Preview 4 - Release Notes](https://github.com/dotnet/core/blob/main/release-notes/9.0/preview/preview4/wpf.md).
0 commit comments