Skip to content

Commit

Permalink
Update SG cookbook (#48182)
Browse files Browse the repository at this point in the history
* Add incremental section

* Add example warning
  • Loading branch information
chsienki authored Oct 2, 2020
1 parent afd1030 commit 2cd81a1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/features/source-generators.cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,10 @@ public class InteractiveGenerator : ISourceGenerator
}
```

*Note*: Until these interfaces are made available, generator authors should not try and emulate 'incrementality' with caching to disk and custom up-to-date checks.
The compiler currently provides no reliable way for a generator to detect if it is suitable to use a previous run, and any attempt to do so will
likely lead to hard to diagnose bugs for consumers. Generator authors should always assume this is a 'full' generation, happening for the first time.

### Serialization

**User Scenario**
Expand Down Expand Up @@ -859,6 +863,8 @@ TODO:

## Breaking Changes:

**Implementation status:** Implemented in Visual Studio 16.8 preview3 / roslyn version 3.8.0-3.final onwards

Between preview and release the following breaking changes were introduced:

**Rename `SourceGeneratorContext` to `GeneratorExecutionContext`**
Expand All @@ -874,6 +880,12 @@ public interface ISourceGenerator
}
```

Users attempting to use a generator targeting the preview APIs against a later version of Roslyn will see an exception similar to:

```csharp
CSC : warning CS8032: An instance of analyzer Generator.HelloWorldGenerator cannot be created from Generator.dll : Method 'Initialize' in type 'Generator.HelloWorldGenerator' from assembly 'Generator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation. [Consumer.csproj]
```

The required action from the user is to rename the parameter types of the `Initialize` and `Execute` methods to match.

**Rename `RunFullGeneration` to `RunGeneratorsAndUpdateCompilation`**
Expand Down

0 comments on commit 2cd81a1

Please sign in to comment.