Skip to content
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
44 changes: 40 additions & 4 deletions .openpublishing.redirection.csharp.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,20 +325,32 @@
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0834.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#conversion-to-expression-trees"
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0843.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/feature-version-errors"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0845.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0846.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs0854.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1921.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1946.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs3007.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
Expand Down Expand Up @@ -1348,6 +1360,10 @@
"source_path_from_root": "/docs/csharp/misc/cs0748.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#lambda-expression-parameters-and-returns"
},
{
"source_path_from_root": "/docs/csharp/misc/cs0765.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/misc/cs0820.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
Expand All @@ -1356,9 +1372,21 @@
"source_path_from_root": "/docs/csharp/misc/cs0824.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/constructor-errors#constructor-declarations"
},
{
"source_path_from_root": "/docs/csharp/misc/cs0831.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/misc/cs0832.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/misc/cs0835.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#conversion-to-expression-trees"
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/misc/cs0838.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1529.md",
Expand Down Expand Up @@ -1408,13 +1436,21 @@
"source_path_from_root": "/docs/csharp/misc/cs1925.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/array-declaration-errors"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1944.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1945.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1951.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#syntax-limitations-in-lambda-expressions"
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1952.md",
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/lambda-expression-errors#syntax-limitations-in-lambda-expressions"
"redirect_url": "/dotnet/csharp/language-reference/compiler-messages/expression-tree-restrictions"
},
{
"source_path_from_root": "/docs/csharp/misc/cs1953.md",
Expand Down
2 changes: 1 addition & 1 deletion docs/azure/sdk/dependency-injection.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ In the preceding code:

## Use the registered clients

With the clients registered, as described in the [Register clients and subclients](#register-clients-and-subclients) section, you can now use them. In the following example, [constructor injection](/dotnet/core/extensions/dependency-injection#constructor-injection-behavior) is used to obtain the Blob Storage client in an ASP.NET Core API controller:
With the clients registered, as described in the [Register clients and subclients](#register-clients-and-subclients) section, you can now use them. In the following example, [constructor injection](../../core/extensions/dependency-injection.md#constructor-injection-behavior) is used to obtain the Blob Storage client in an ASP.NET Core API controller:

```csharp
[ApiController]
Expand Down
2 changes: 1 addition & 1 deletion docs/azure/sdk/unit-testing-mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ When unit testing you only want the unit tests to verify the application logic a

## Refactor your types for testability

Classes that need to be tested should be designed for [dependency injection](/dotnet/azure/sdk/dependency-injection), which allows the class to receive its dependencies instead of creating them internally. It was a seamless process to replace the `SecretClient` implementation in the example from the previous section because it was one of the constructor parameters. However, there may be classes in your code that create their own dependencies and aren't easily testable, such as the following:
Classes that need to be tested should be designed for [dependency injection](dependency-injection.md), which allows the class to receive its dependencies instead of creating them internally. It was a seamless process to replace the `SecretClient` implementation in the example from the previous section because it was one of the constructor parameters. However, there may be classes in your code that create their own dependencies and aren't easily testable, such as the following:

```csharp
public class AboutToExpireSecretFinder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Because of the dependency limitations, a self-contained test app which uses the
* The library code.
* The code that the library references from its dependencies.

***Note:*** If the library has different behavior depending on the target framework, create a trimming test app for each of the target frameworks that support trimming. For example, if the library uses [conditional compilation](/dotnet/csharp/language-reference/preprocessor-directives#conditional-compilation) such as `#if NET7_0` to change behavior.
***Note:*** If the library has different behavior depending on the target framework, create a trimming test app for each of the target frameworks that support trimming. For example, if the library uses [conditional compilation](../../../csharp/language-reference/preprocessor-directives.md#conditional-compilation) such as `#if NET7_0` to change behavior.

To create the trimming test app:

Expand Down Expand Up @@ -206,7 +206,7 @@ In this case, the trim analysis keeps public methods of <xref:System.Tuple>, and
* When code is incompatible with trimming, annotate it with `RequiresUnreferencedCode` and propagate this annotation to callers until the relevant public APIs are annotated.
* Avoid using code that uses reflection in a way not understood by the static analysis. For example, reflection in static constructors should be avoided. Using statically unanalyzable reflection in static constructors result in the warning propagating to all members of the class.
* Avoid annotating virtual methods or interface methods. Annotating virtual or interface methods requires all overrides to have matching annotations.
* If an API is mostly trim-incompatible, alternative coding approaches to the API may need to be considered. A common example is reflection-based serializers. In these cases, consider adopting other technology like source generators to produce code that is more easily statically analyzed. For example, see [How to use source generation in System.Text.Json](/dotnet/standard/serialization/system-text-json/source-generation)
* If an API is mostly trim-incompatible, alternative coding approaches to the API may need to be considered. A common example is reflection-based serializers. In these cases, consider adopting other technology like source generators to produce code that is more easily statically analyzed. For example, see [How to use source generation in System.Text.Json](../../../standard/serialization/system-text-json/source-generation.md)

## Resolve warnings for non-analyzable patterns

Expand Down
43 changes: 0 additions & 43 deletions docs/csharp/language-reference/compiler-messages/cs0845.md

This file was deleted.

43 changes: 0 additions & 43 deletions docs/csharp/language-reference/compiler-messages/cs0854.md

This file was deleted.

43 changes: 0 additions & 43 deletions docs/csharp/language-reference/compiler-messages/cs1946.md

This file was deleted.

Loading