Skip to content

Commit 6d09ae3

Browse files
authored
Merge pull request #21270 from dotnet/publish-19895
Merge master into live
2 parents 4a93832 + 7429e98 commit 6d09ae3

17 files changed

+80
-119
lines changed

.openpublishing.redirection.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11502,8 +11502,7 @@
1150211502
},
1150311503
{
1150411504
"source_path": "docs/standard/events/how-to-consume-events-in-a-web-forms-application.md",
11505-
"redirect_url": "/aspnet/web-forms/overview/how-to-consume-events",
11506-
"redirect_document_id": true
11505+
"redirect_url": "/aspnet/web-forms/overview/how-to-consume-events"
1150711506
},
1150811507
{
1150911508
"source_path": "docs/standard/exceptions.md",
@@ -11610,6 +11609,11 @@
1161011609
"redirect_url": "/dotnet/standard/parallel-programming/introduction-to-plinq",
1161111610
"redirect_document_id": true
1161211611
},
11612+
{
11613+
"source_path": "docs/standard/parallel-programming/using-tpl-with-other-asynchronous-patterns.md",
11614+
"redirect_url": "/dotnet/standard/parallel-programming/tpl-and-traditional-async-programming",
11615+
"redirect_document_id": true
11616+
},
1161311617
{
1161411618
"source_path": "docs/standard/portability-analyzer.md",
1161511619
"redirect_url": "/dotnet/standard/analyzers/portability-analyzer",

docs/core/deploying/trim-self-contained.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,39 @@ When the code is indirectly referencing an assembly through reflection, you can
3232
</ItemGroup>
3333
```
3434

35+
### Support for SSL certificates
36+
37+
If your app loads SSL certificates, such as in an ASP.NET Core app, you'll want to ensure that when trimming you prevent trimming assemblies that will help with loading SSL certificates.
38+
39+
We can update our project file to include the following for ASP.NET Core 3.1:
40+
41+
```xml
42+
<Project Sdk="Microsoft.NET.Sdk.Web">
43+
<PropertyGroup>...</PropertyGroup>
44+
<!--Include the following for .aspnetcore 3.1-->
45+
<ItemGroup>
46+
<TrimmerRootAssembly Include="System.Net" />
47+
<TrimmerRootAssembly Include="System.Net.Security" />
48+
<TrimmerRootAssembly Include="System.Security" />
49+
</ItemGroup>
50+
...
51+
</Project>
52+
```
53+
54+
If we're using .Net 5.0, we can update our project file to include the following:
55+
56+
```xml
57+
<Project Sdk="Microsoft.NET.Sdk.Web">
58+
<PropertyGroup>...</PropertyGroup>
59+
<!--Include the following for .net 5.0-->
60+
<ItemGroup>
61+
<TrimmerRootAssembly Include="System.Net.Security" />
62+
<TrimmerRootAssembly Include="System.Security" />
63+
</ItemGroup>
64+
...
65+
</Project>
66+
```
67+
3568
## Trim your app - CLI
3669

3770
Trim your application using the [dotnet publish](../tools/dotnet-publish.md) command. When you publish your app, set the following properties:

docs/fundamentals/toc.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,10 +1734,9 @@ items:
17341734
href: ../standard/parallel-programming/how-to-specify-a-task-scheduler-in-a-dataflow-block.md
17351735
- name: "Walkthrough: Using BatchBlock and BatchedJoinBlock to Improve Efficiency"
17361736
href: ../standard/parallel-programming/walkthrough-using-batchblock-and-batchedjoinblock-to-improve-efficiency.md
1737-
- name: Using TPL with Other Asynchronous Patterns
1738-
href: ../standard/parallel-programming/using-tpl-with-other-asynchronous-patterns.md
1737+
- name: Use TPL with Other Asynchronous Patterns
17391738
items:
1740-
- name: TPL and Traditional .NET Framework Asynchronous Programming
1739+
- name: TPL and Traditional .NET Asynchronous Programming
17411740
href: ../standard/parallel-programming/tpl-and-traditional-async-programming.md
17421741
- name: "How to: Wrap EAP Patterns in a Task"
17431742
href: ../standard/parallel-programming/how-to-wrap-eap-patterns-in-a-task.md

docs/standard/parallel-programming/data-structures-for-parallel-programming.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ helpviewer_keywords:
77
ms.assetid: bdc82f2f-4754-45a1-a81e-fe2e9c30cef9
88
---
99
# Data Structures for Parallel Programming
10-
The .NET Framework version 4 introduces several new types that are useful in parallel programming, including a set of concurrent collection classes, lightweight synchronization primitives, and types for lazy initialization. You can use these types with any multithreaded application code, including the Task Parallel Library and PLINQ.
10+
11+
.NET provides several types that are useful in parallel programming, including a set of concurrent collection classes, lightweight synchronization primitives, and types for lazy initialization. You can use these types with any multithreaded application code, including the Task Parallel Library and PLINQ.
1112

1213
## Concurrent Collection Classes
13-
The collection classes in the <xref:System.Collections.Concurrent?displayProperty=nameWithType> namespace provide thread-safe add and remove operations that avoid locks wherever possible and use fine-grained locking where locks are necessary. Unlike collections that were introduced in the .NET Framework versions 1.0 and 2.0, a concurrent collection class does not require user code to take any locks when it accesses items. The concurrent collection classes can significantly improve performance over types such as <xref:System.Collections.ArrayList?displayProperty=nameWithType> and <xref:System.Collections.Generic.List%601?displayProperty=nameWithType> (with user-implemented locking) in scenarios where multiple threads add and remove items from a collection.
14+
The collection classes in the <xref:System.Collections.Concurrent?displayProperty=nameWithType> namespace provide thread-safe add and remove operations that avoid locks wherever possible and use fine-grained locking where locks are necessary. A concurrent collection class does not require user code to take any locks when it accesses items. The concurrent collection classes can significantly improve performance over types such as <xref:System.Collections.ArrayList?displayProperty=nameWithType> and <xref:System.Collections.Generic.List%601?displayProperty=nameWithType> (with user-implemented locking) in scenarios where multiple threads add and remove items from a collection.
1415

15-
The following table lists the new concurrent collection classes:
16+
The following table lists the concurrent collection classes:
1617

1718
|Type|Description|
1819
|----------|-----------------|
@@ -25,9 +26,9 @@ The .NET Framework version 4 introduces several new types that are useful in par
2526
For more information, see [Thread-Safe Collections](../collections/thread-safe/index.md).
2627

2728
## Synchronization Primitives
28-
The new synchronization primitives in the <xref:System.Threading?displayProperty=nameWithType> namespace enable fine-grained concurrency and faster performance by avoiding expensive locking mechanisms found in legacy multithreading code. Some of the new types, such as <xref:System.Threading.Barrier?displayProperty=nameWithType> and <xref:System.Threading.CountdownEvent?displayProperty=nameWithType> have no counterparts in earlier releases of the .NET Framework.
29+
The synchronization primitives in the <xref:System.Threading?displayProperty=nameWithType> namespace enable fine-grained concurrency and faster performance by avoiding expensive locking mechanisms found in legacy multithreading code.
2930

30-
The following table lists the new synchronization types:
31+
The following table lists the synchronization types:
3132

3233
|Type|Description|
3334
|----------|-----------------|

docs/standard/parallel-programming/how-to-iterate-file-directories-with-plinq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The second query uses the static <xref:System.IO.Directory.EnumerateDirectories%
2929

3030
When using <xref:System.IO.Directory.GetFiles%2A>, be sure that you have sufficient permissions on all directories in the tree. Otherwise, an exception will be thrown and no results will be returned. When using the <xref:System.IO.Directory.EnumerateDirectories%2A> in a PLINQ query, it is problematic to handle I/O exceptions in a graceful way that enables you to continue iterating. If your code must handle I/O or unauthorized access exceptions, then you should consider the approach described in [How to: Iterate File Directories with the Parallel Class](how-to-iterate-file-directories-with-the-parallel-class.md).
3131

32-
If I/O latency is an issue, for example with file I/O over a network, consider using one of the asynchronous I/O techniques described in [TPL and Traditional .NET Framework Asynchronous Programming](tpl-and-traditional-async-programming.md) and in this [blog post](https://devblogs.microsoft.com/pfxteam/parallel-extensions-and-io/).
32+
If I/O latency is an issue, for example with file I/O over a network, consider using one of the asynchronous I/O techniques described in [TPL and Traditional .NET Asynchronous Programming](tpl-and-traditional-async-programming.md) and in this [blog post](https://devblogs.microsoft.com/pfxteam/parallel-extensions-and-io/).
3333

3434
## See also
3535

docs/standard/parallel-programming/how-to-iterate-file-directories-with-the-parallel-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ In many cases, file iteration is an operation that can be easily parallelized. T
1818
[!code-csharp[TPL_Parallel#08](../../../samples/snippets/csharp/VS_Snippets_Misc/tpl_parallel/cs/parallel_file.cs#08)]
1919
[!code-vb[TPL_Parallel#08](../../../samples/snippets/visualbasic/VS_Snippets_Misc/tpl_parallel/vb/fileiteration08.vb#08)]
2020

21-
In this example, the file I/O is performed synchronously. When dealing with large files or slow network connections, it might be preferable to access the files asynchronously. You can combine asynchronous I/O techniques with parallel iteration. For more information, see [TPL and Traditional .NET Framework Asynchronous Programming](tpl-and-traditional-async-programming.md).
21+
In this example, the file I/O is performed synchronously. When dealing with large files or slow network connections, it might be preferable to access the files asynchronously. You can combine asynchronous I/O techniques with parallel iteration. For more information, see [TPL and Traditional .NET Asynchronous Programming](tpl-and-traditional-async-programming.md).
2222

2323
The example uses the local `fileCount` variable to maintain a count of the total number of files processed. Because the variable might be accessed concurrently by multiple tasks, access to it is synchronized by calling the <xref:System.Threading.Interlocked.Add%2A?displayProperty=nameWithType> method.
2424

docs/standard/parallel-programming/how-to-wrap-eap-patterns-in-a-task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ The following example shows how to expose an arbitrary sequence of Event-Based A
1818

1919
## See also
2020

21-
- [TPL and Traditional .NET Framework Asynchronous Programming](tpl-and-traditional-async-programming.md)
21+
- [TPL and Traditional .NET Asynchronous Programming](tpl-and-traditional-async-programming.md)

docs/standard/parallel-programming/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ ms.assetid: 4d83c690-ad2d-489e-a2e0-b85b898a672d
1111

1212
Many personal computers and workstations have multiple CPU cores that enable multiple threads to be executed simultaneously. To take advantage of the hardware, you can parallelize your code to distribute work across multiple processors.
1313

14-
In the past, parallelization required low-level manipulation of threads and locks. Visual Studio and the .NET Framework enhance support for parallel programming by providing a runtime, class library types, and diagnostic tools. These features, which were introduced with the .NET Framework 4, simplify parallel development. You can write efficient, fine-grained, and scalable parallel code in a natural idiom without having to work directly with threads or the thread pool.
14+
In the past, parallelization required low-level manipulation of threads and locks. Visual Studio and .NET enhance support for parallel programming by providing a runtime, class library types, and diagnostic tools. These features, which were introduced in .NET Framework 4, simplify parallel development. You can write efficient, fine-grained, and scalable parallel code in a natural idiom without having to work directly with threads or the thread pool.
1515

16-
The following illustration provides a high-level overview of the parallel programming architecture in the .NET Framework:
16+
The following illustration provides a high-level overview of the parallel programming architecture in .NET.
1717

1818
![.NET Parallel Programming Architecture](./media/tpl-architecture.png)
1919

docs/standard/parallel-programming/introduction-to-plinq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The following illustration shows the difference between `foreach` and <xref:Syst
103103

104104
## Cancellation
105105

106-
PLINQ is integrated with the cancellation types in .NET Framework 4. (For more information, see [Cancellation in Managed Threads](../threading/cancellation-in-managed-threads.md).) Therefore, unlike sequential LINQ to Objects queries, PLINQ queries can be canceled. To create a cancelable PLINQ query, use the <xref:System.Linq.ParallelEnumerable.WithCancellation%2A> operator on the query and provide a <xref:System.Threading.CancellationToken> instance as the argument. When the <xref:System.Threading.CancellationToken.IsCancellationRequested%2A> property on the token is set to true, PLINQ will notice it, stop processing on all threads, and throw an <xref:System.OperationCanceledException>.
106+
PLINQ is integrated with the cancellation types in .NET. (For more information, see [Cancellation in Managed Threads](../threading/cancellation-in-managed-threads.md).) Therefore, unlike sequential LINQ to Objects queries, PLINQ queries can be canceled. To create a cancelable PLINQ query, use the <xref:System.Linq.ParallelEnumerable.WithCancellation%2A> operator on the query and provide a <xref:System.Threading.CancellationToken> instance as the argument. When the <xref:System.Threading.CancellationToken.IsCancellationRequested%2A> property on the token is set to true, PLINQ will notice it, stop processing on all threads, and throw an <xref:System.OperationCanceledException>.
107107

108108
It is possible that a PLINQ query might continue to process some elements after the cancellation token is set.
109109

docs/standard/parallel-programming/potential-pitfalls-in-data-and-task-parallelism.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ In many cases, <xref:System.Threading.Tasks.Parallel.For%2A?displayProperty=name
3939
[!code-vb[TPL_Pitfalls#04](../../../samples/snippets/visualbasic/VS_Snippets_Misc/tpl_pitfalls/vb/pitfalls_vb.vb#04)]
4040

4141
## Limit Calls to Thread-Safe Methods
42-
Most static methods in the .NET Framework are thread-safe and can be called from multiple threads concurrently. However, even in these cases, the synchronization involved can lead to significant slowdown in the query.
42+
Most static methods in .NET are thread-safe and can be called from multiple threads concurrently. However, even in these cases, the synchronization involved can lead to significant slowdown in the query.
4343

4444
> [!NOTE]
4545
> You can test for this yourself by inserting some calls to <xref:System.Console.WriteLine%2A> in your queries. Although this method is used in the documentation examples for demonstration purposes, do not use it in parallel loops unless necessary.
@@ -63,7 +63,7 @@ In many cases, <xref:System.Threading.Tasks.Parallel.For%2A?displayProperty=name
6363
## Avoid Executing Parallel Loops on the UI Thread
6464
It is important to keep your application's user interface (UI) responsive. If an operation contains enough work to warrant parallelization, then it likely should not be run that operation on the UI thread. Instead, it should offload that operation to be run on a background thread. For example, if you want to use a parallel loop to compute some data that should then be rendered into a UI control, you should consider executing the loop within a task instance rather than directly in a UI event handler. Only when the core computation has completed should you then marshal the UI update back to the UI thread.
6565

66-
If you do run parallel loops on the UI thread, be careful to avoid updating UI controls from within the loop. Attempting to update UI controls from within a parallel loop that is executing on the UI thread can lead to state corruption, exceptions, delayed updates, and even deadlocks, depending on how the UI update is invoked. In the following example, the parallel loop blocks the UI thread on which its executing until all iterations are complete. However, if an iteration of the loop is running on a background thread (as <xref:System.Threading.Tasks.Parallel.For%2A> may do), the call to Invoke causes a message to be submitted to the UI thread and blocks waiting for that message to be processed. Since the UI thread is blocked running the <xref:System.Threading.Tasks.Parallel.For%2A>, the message can never be processed, and the UI thread deadlocks.
66+
If you do run parallel loops on the UI thread, be careful to avoid updating UI controls from within the loop. Attempting to update UI controls from within a parallel loop that is executing on the UI thread can lead to state corruption, exceptions, delayed updates, and even deadlocks, depending on how the UI update is invoked. In the following example, the parallel loop blocks the UI thread on which it's executing until all iterations are complete. However, if an iteration of the loop is running on a background thread (as <xref:System.Threading.Tasks.Parallel.For%2A> may do), the call to Invoke causes a message to be submitted to the UI thread and blocks waiting for that message to be processed. Since the UI thread is blocked running the <xref:System.Threading.Tasks.Parallel.For%2A>, the message can never be processed, and the UI thread deadlocks.
6767

6868
[!code-csharp[TPL_Pitfalls#02](../../../samples/snippets/csharp/VS_Snippets_Misc/tpl_pitfalls/cs/pitfalls.cs#02)]
6969
[!code-vb[TPL_Pitfalls#02](../../../samples/snippets/visualbasic/VS_Snippets_Misc/tpl_pitfalls/vb/pitfalls_vb.vb#02)]

0 commit comments

Comments
 (0)