<commit_before>Source Generators
=================

Summary
-------
Source generators provide a mechanism through which source code can be generated at compile time
and added to the compilation. The additional source can be based on the content of the compilation,
enabling some meta-programming scenarios.

Scenarios
---------
* Generate `BoundNode` classes from record definitions.
* Implement `System.ComponentModel.INotifyPropertyChanged`.
* Support code contracts defined through attributes.
* Generate types from structured data similar to F# Type Providers.

General
-------
Source generators are implementations of `Microsoft.CodeAnalysis.SourceGenerator`.
```
    public abstract class SourceGenerator
    {
        public abstract void Execute(SourceGeneratorContext context);
    }
```
`SourceGenerator` implementations are defined in external assemblies passed to the compiler
using the same `-analyzer:` option used for diagnostic analyzers. An assembly can
contain a mix of diagnostic analyzers and source generators.
Since generators are loaded from external assemblies, a generator cannot be used to build
the assembly in which it is defined.<commit_msg>Fixes to source generator documentation (#11855)<commit_after>Source Generators
=================

Summary
-------
Source generators provide a mechanism through which source code can be generated at compile time
and added to the compilation. The additional source can be based on the content of the compilation,
enabling some meta-programming scenarios.

Like all pre-release features, code generators will need to be specially enabled, either by passing
`/features:replace` directly to `csc` or by setting the `<Features>replace</Features>` flag in the project file.

Scenarios
---------
* Generate `BoundNode` classes from record definitions.
* Implement `System.ComponentModel.INotifyPropertyChanged`.
* Support code contracts defined through attributes.
* Generate types from structured data similar to F# Type Providers.
* Serialization/deserialization (see https://github.com/agocke/json-serializer)

General
-------
Source generators are implementations of `Microsoft.CodeAnalysis.SourceGenerator`.
```
    public abstract class SourceGenerator
    {
        public abstract void Execute(SourceGeneratorContext context);
    }
```
`SourceGenerator` implementations are defined in external assemblies passed to the compiler
using the same `-analyzer:` option used for diagnostic analyzers. Valid source generators
must:

1. Implement `Microsoft.CodeAnalysis.SourceGenerator`
1. Be decorated with the `Microsoft.CodeAnalysis.SourceGeneratorAttribute` to indicate 
   supported languages.

An assembly can contain a mix of diagnostic analyzers and source generators.
Since generators are loaded from external assemblies, a generator cannot be used to build
the assembly in which it is defined.
{'fraction_non_alphanumeric': 0.07638646668991977, 'fraction_numerical': 0.002441576560865016, 'mean_word_length': 4.817444219066937, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2459179', 'n_tokens_mistral': 655, 'n_tokens_neox': 621, 'n_words': 321}