Code generation fails if project includes source generation
- Dominant language
- C#
- Stars
- 818
- Forks
- 260
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 10
Description
## Code Generation Issue
I cannot get the scaffolder to work. I have a .NET 10 Preview project that I just downgraded to .NET 9 in order to be able to run the scaffolder (in .NET 10 I just get a NullReferenceException in visual studio). I used extension members that i downgraded to the previous static extension methods.
Apart from the preview language features that seem to be not supported by the scaffolder, it seems to have issues with source generated code.
### Logger Messages
The scaffolder wont compile my project if it includes sourcegen logger messages such as this one:
```C#
public partial class SmtpClient(ILogger logger) {
[LoggerMessage(LogLevel.Information, Message = "Client authenticated!")]
private partial void LogAuthenticated();
}
```
```
SmtpClient.cs(36,26): error CS8795: Partial method 'SmtpClient.LogAuthenticated()' must have an implementation part because it has accessibility modifiers.
```
### Strongly Typed IDs
Strongly Typed IDs also cause issues:
```
ApplicationDbContext.cs(26,37): error CS0426: The type name 'EfCoreValueConverter' does not exist in the type 'GroupId'
GroupManager.cs(17,28): error CS0019: Operator '==' cannot be applied to operands of type 'GroupId' and 'GroupId'
```
### Include provider and version information
dotnet-aspnet-codegenerator version: 9.0.0
Microsoft.VisualStudio.Web.CodeGeneration.Design version: 9.0.0
Microsoft.AspNetCode.Identity.UI version: 9.0.6
Target framework: .NET 9
Operating system: Windows 11
IDE: Visual Studio 2022 Version 17.14.5 Preview 1.0
Contributor guide
Assessment
This issue has not been assessed yet.