ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#โ€ข3y agoโ€ข
51 replies
QzL

โ” Incremental source generator not called with docker

Hello,

I have 2 projects (simplified):
- one sandbox .net6
- one SourceGenerator .netStandard2.0

In my SourceGenerator, I have a class called RestServicesSourceGenerator like this

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;

[Generator]
public sealed class RestServicesSourceGenerator
    : IIncrementalGenerator
{
    public RestServicesSourceGenerator()
    {
    }

    void IIncrementalGenerator.Initialize(IncrementalGeneratorInitializationContext context)
    {
        // processing code
    }
}
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;

[Generator]
public sealed class RestServicesSourceGenerator
    : IIncrementalGenerator
{
    public RestServicesSourceGenerator()
    {
    }

    void IIncrementalGenerator.Initialize(IncrementalGeneratorInitializationContext context)
    {
        // processing code
    }
}


And in my sandbox project, I have a reference of my SourceGenerator

<ProjectReference Include="..\..\project.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="true" />
<ProjectReference Include="..\..\project.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="true" />


When i start building my sandbox (from VS or from command line
dotnet build --no-incremental
dotnet build --no-incremental
), the IIncrementalGenerator.Initialize is executed and i can see my generated files.

When i start building from docker using this image
mcr.microsoft.com/dotnet/sdk:6.0
mcr.microsoft.com/dotnet/sdk:6.0
nothing happens. ๐Ÿ˜ญ

When i start building from azure pipepline using
vmImage: 'ubuntu-latest'
vmImage: 'ubuntu-latest'
it's work ๐Ÿ˜…

If someone have an idea ๐Ÿฅน


Deps are :
<PackageReference Update="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.5.0" PrivateAssets="all" />
<PackageReference Update="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.5.0" PrivateAssets="all" />


#rosyln
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

Incremental Generator
C#CC# / help
3y ago
Creating and using an incremental source generator
C#CC# / help
4y ago
Incremental generator not outputting generated members
C#CC# / help
2y ago
โ” Incremental Generator compilation error
C#CC# / help
3y ago