Skip to content

Commit

Permalink
Remove source generators overview (#43206)
Browse files Browse the repository at this point in the history
* Remove source generators overview

The cookbook, from the roslyn SDK is a better choice.

* Change the redirect to match our rules

* Remove dependent files

* Use clean-repo to replace links.

Update all the links to the original target article.

* Update docs/csharp/roslyn-sdk/index.md

Co-authored-by: Genevieve Warren <[email protected]>

---------

Co-authored-by: Genevieve Warren <[email protected]>
  • Loading branch information
BillWagner and gewarren authored Oct 25, 2024
1 parent 533033d commit 56d4947
Show file tree
Hide file tree
Showing 22 changed files with 24 additions and 269 deletions.
4 changes: 4 additions & 0 deletions .openpublishing.redirection.csharp.json
Original file line number Diff line number Diff line change
Expand Up @@ -4052,6 +4052,10 @@
"source_path_from_root": "/docs/csharp/roslyn/index.md",
"redirect_url": "/dotnet/csharp/roslyn-sdk/"
},
{
"source_path_from_root": "/docs/csharp/roslyn-sdk/source-generators-overview.md",
"redirect_url": "/dotnet/csharp/roslyn-sdk/#source-generators"
},
{
"source_path_from_root": "/docs/csharp/whats-new/tutorials/static-abstract-interface-methods.md",
"redirect_url": "/dotnet/csharp/whats-new/tutorials/static-virtual-interface-members"
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/maui/mvvm-community-toolkit-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ For more detailed information on implementing commands, see the section [Impleme

## Source Generators

Using the MVVM Toolkit components out-of-the-box allows you to greatly simplify our ViewModel. The MVVM Toolkit allows you to simplify common code use cases even further by using [Source Generators](../../csharp/roslyn-sdk/source-generators-overview.md). The MVVM Toolkit source generators look for specific attributes in our code and can generate wrappers for properties and commands.
Using the MVVM Toolkit components out-of-the-box allows you to greatly simplify our ViewModel. The MVVM Toolkit allows you to simplify common code use cases even further by using [Source Generators](../../csharp/roslyn-sdk/index.md#source-generators). The MVVM Toolkit source generators look for specific attributes in our code and can generate wrappers for properties and commands.

> [!IMPORTANT]
> The MVVM Toolkit Source Generators generate code that is additive to our existing objects. Because of this, any object that is leveraging a source generator will need to be marked as `partial`.
Expand Down
2 changes: 1 addition & 1 deletion docs/core/docker/build-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ If you pass a number on the command line to the app, it will only count up to th
## Publish .NET app

In order for the app to be suitable for an image creation it has to be built. The `dotnet publish` command is most apt for this, as it builds and publishes the app. For an in-depth reference, see [dotnet build](/dotnet/core/tools/dotnet-build) and [dotnet publish](/dotnet/core/tools/dotnet-publish) commands documentation.
In order for the app to be suitable for an image creation it has to be built. The `dotnet publish` command is most apt for this, as it builds and publishes the app. For an in-depth reference, see [dotnet build](../tools/dotnet-build.md) and [dotnet publish](../tools/dotnet-publish.md) commands documentation.

```dotnetcli
dotnet publish -c Release
Expand Down
4 changes: 2 additions & 2 deletions docs/core/extensions/configuration-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ms.date: 10/09/2024

Starting with .NET 8, a configuration binding source generator was introduced that intercepts specific call sites and generates their functionality. This feature provides a [Native ahead-of-time (AOT)](../deploying/native-aot/index.md) and [trim-friendly](../deploying/trimming/trim-self-contained.md) way to use the [configuration binder](configuration.md#binding), without the use of the reflection-based implementation. Reflection requires dynamic code generation, which isn't supported in AOT scenarios.

This feature is possible with the advent of [C# interceptors](/dotnet/csharp/whats-new/csharp-12#interceptors) that were introduced in C# 12. Interceptors allow the compiler to generate source code that intercepts specific calls and substitutes them with generated code.
This feature is possible with the advent of [C# interceptors](../../csharp/whats-new/csharp-12.md#interceptors) that were introduced in C# 12. Interceptors allow the compiler to generate source code that intercepts specific calls and substitutes them with generated code.

## Enable the configuration source generator

Expand Down Expand Up @@ -52,7 +52,7 @@ The preceding code:
When the application is built, the configuration source generator intercepts the call to `GetValue<T>` and generates the binding code.

> [!IMPORTANT]
> When the `PublishAot` property is set to `true` (or any other AOT warnings are enabled) and the `EnabledConfigurationBindingGenerator` property is set to `false`, warning `IL2026` is raised. This warning indicates that members are attributed with [RequiresUnreferencedCode](xref:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute) may break when trimming. For more information, see [IL2026](/dotnet/core/deploying/trimming/trim-warnings/il2026).
> When the `PublishAot` property is set to `true` (or any other AOT warnings are enabled) and the `EnabledConfigurationBindingGenerator` property is set to `false`, warning `IL2026` is raised. This warning indicates that members are attributed with [RequiresUnreferencedCode](xref:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute) may break when trimming. For more information, see [IL2026](../deploying/trimming/trim-warnings/il2026.md).
### Explore the source generated code

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ Let's examine the apis and their mean:
* `OneOrMore`: Represents an argument arity of one or more.
* `ExactlyOne`: Represents an argument arity of exactly one.

For examples, refer to the [System.CommandLine arity table](/dotnet/standard/commandline/syntax#argument-arity).
For examples, refer to the [System.CommandLine arity table](../../standard/commandline/syntax.md#argument-arity).

`bool isHidden`: This property signifies that the option is available for use but will not be displayed in the description when `--help` is invoked.

Expand Down
2 changes: 1 addition & 1 deletion docs/core/whats-new/dotnet-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Many improvements have been made in <xref:System.Text.Json?displayProperty=fullN

### Source generator

.NET 6 adds a new [source generator](../../csharp/roslyn-sdk/source-generators-overview.md) for <xref:System.Text.Json?displayProperty=fullName>. Source generation works with <xref:System.Text.Json.JsonSerializer> and can be configured in multiple ways. It can improve performance, reduce memory usage, and facilitate assembly trimming. For more information, see [How to choose reflection or source generation in System.Text.Json](../../standard/serialization/system-text-json/source-generation-modes.md) and [How to use source generation in System.Text.Json](../../standard/serialization/system-text-json/source-generation.md).
.NET 6 adds a new [source generator](../../csharp/roslyn-sdk/index.md#source-generators) for <xref:System.Text.Json?displayProperty=fullName>. Source generation works with <xref:System.Text.Json.JsonSerializer> and can be configured in multiple ways. It can improve performance, reduce memory usage, and facilitate assembly trimming. For more information, see [How to choose reflection or source generation in System.Text.Json](../../standard/serialization/system-text-json/source-generation-modes.md) and [How to use source generation in System.Text.Json](../../standard/serialization/system-text-json/source-generation.md).

### Writeable DOM

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ There are several situations when splitting a class definition is desirable:

- Declaring a class over separate files enables multiple programmers to work on it at the same time.
- You can add code to the class without having to recreate the source file that includes automatically generated source. Visual Studio uses this approach when it creates Windows Forms, Web service wrapper code, and so on. You can create code that uses these classes without having to modify the file created by Visual Studio.
- [Source generators](../../roslyn-sdk/source-generators-overview.md) can generate extra functionality in a class.
- [Source generators](../../roslyn-sdk/index.md#source-generators) can generate extra functionality in a class.

To split a class definition, use the [partial](../../language-reference/keywords/partial-type.md) keyword modifier, as shown here:

Expand Down
11 changes: 9 additions & 2 deletions docs/csharp/roslyn-sdk/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
title: The .NET Compiler Platform SDK (Roslyn APIs)
description: Learn to use the .NET Compiler Platform SDK (also called the Roslyn APIs) to understand .NET code, spot errors, and fix those errors.
ms.date: 10/10/2017
ms.date: 10/25/2024
ms.custom: mvc
---

# The .NET Compiler Platform SDK

Compilers build a detailed model of application code as they validate the
Expand Down Expand Up @@ -119,6 +118,14 @@ learn accepted practices quickly and become productive earlier in their .NET
journey. As these become more widely used, the community adopts these
practices.

## Source generators

Source generators aim to enable *compile time metaprogramming*, that is, code that can be created
at compile time and added to the compilation. Source generators are able to read the contents of
the compilation before running, as well as access any *additional files*. This ability enables them to
introspect both user C# code and generator-specific files. You can learn how to build incremental
source generators using the [source generator cookbook](https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.cookbook.md).

## Next steps

The .NET Compiler Platform SDK includes the latest language object models
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 56d4947

Please sign in to comment.