提问人:Dr_Cox1911 提问时间:8/7/2023 更新时间:8/7/2023 访问量:28
“IIncrementalGenerator”生成器在本地,但不在 Github Action 中
`IIncrementalGenerator` generators locally but not in Github Action
问:
我正在开发一个源代码生成器,该生成器目前在四台不同的机器(两台 Windows,两台 Linux)上运行良好,但是当我的 Github Action 构建项目时,生成器失败并显示 .TypeInitializationException
我在所有四台机器上都执行了完全相同的命令,整个管道在本地工作。我什至调整了我的管道以附加一个,但不幸的是,我不够熟练,无法正确分析它。msbuild.binlog
存储库是这样的:FastLogr
使用以下输出执行时,管道失败:dotnet build -c Release --no-restore --force /bl
Run dotnet build -c Release --no-restore --force /bl
MSBuild version 17.6.8+c70978d4d for .NET
FastLogr.Attributes -> /home/runner/work/FastLogr/FastLogr/src/FastLogr.Attributes/bin/Release/netstandard2.0/FastLogr.Attributes.dll
FastLogr.Generator -> /home/runner/work/FastLogr/FastLogr/src/FastLogr.Generator/bin/Release/netstandard2.0/FastLogr.Generator.dll
CSC : warning CS8784: Generator 'FastLogrGenerator' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'TypeInitializationException' with message 'The type initializer for 'FastLogr.Generator.FastLogrGenerator' threw an exception.' [/home/runner/work/FastLogr/FastLogr/example/FastLogr.Example.WorkerService/FastLogr.Example.WorkerService.csproj]
Error: /home/runner/work/FastLogr/FastLogr/example/FastLogr.Example.WorkerService/Worker.cs(2,7): error CS0246: The type or namespace name 'SourceGenPlayground' could not be found (are you missing a using directive or an assembly reference?) [/home/runner/work/FastLogr/FastLogr/example/FastLogr.Example.WorkerService/FastLogr.Example.WorkerService.csproj]
FastLogr.Generator.Tests.Verify -> /home/runner/work/FastLogr/FastLogr/test/FastLogr.Generator.Tests.Verify/bin/Release/net7.0/FastLogr.Generator.Tests.Verify.dll
CSC : warning CS8784: Generator 'FastLogrGenerator' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'TypeInitializationException' with message 'The type initializer for 'FastLogr.Generator.FastLogrGenerator' threw an exception.' [/home/runner/work/FastLogr/FastLogr/test/FastLogr.Generator.Tests.Integration/FastLogr.Generator.Tests.Integration.csproj]
Error: /home/runner/work/FastLogr/FastLogr/test/FastLogr.Generator.Tests.Integration/TestCode/PrimitiveTypesTests.cs(2,7): error CS0246: The type or namespace name 'SourceGenPlayground' could not be found (are you missing a using directive or an assembly reference?) [/home/runner/work/FastLogr/FastLogr/test/FastLogr.Generator.Tests.Integration/FastLogr.Generator.Tests.Integration.csproj]
Build FAILED.
CSC : warning CS8784: Generator 'FastLogrGenerator' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'TypeInitializationException' with message 'The type initializer for 'FastLogr.Generator.FastLogrGenerator' threw an exception.' [/home/runner/work/FastLogr/FastLogr/example/FastLogr.Example.WorkerService/FastLogr.Example.WorkerService.csproj]
CSC : warning CS8784: Generator 'FastLogrGenerator' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'TypeInitializationException' with message 'The type initializer for 'FastLogr.Generator.FastLogrGenerator' threw an exception.' [/home/runner/work/FastLogr/FastLogr/test/FastLogr.Generator.Tests.Integration/FastLogr.Generator.Tests.Integration.csproj]
Error: /home/runner/work/FastLogr/FastLogr/example/FastLogr.Example.WorkerService/Worker.cs(2,7): error CS0246: The type or namespace name 'SourceGenPlayground' could not be found (are you missing a using directive or an assembly reference?) [/home/runner/work/FastLogr/FastLogr/example/FastLogr.Example.WorkerService/FastLogr.Example.WorkerService.csproj]
Error: /home/runner/work/FastLogr/FastLogr/test/FastLogr.Generator.Tests.Integration/TestCode/PrimitiveTypesTests.cs(2,7): error CS0246: The type or namespace name 'SourceGenPlayground' could not be found (are you missing a using directive or an assembly reference?) [/home/runner/work/FastLogr/FastLogr/test/FastLogr.Generator.Tests.Integration/FastLogr.Generator.Tests.Integration.csproj]
2 Warning(s)
2 Error(s)
Time Elapsed 00:00:10.20
Error: Process completed with exit code 1.
我试图在 4 台不同的机器上重现该问题,但在那里它可以工作。
我的计算机正在运行以下 dotnet sdk:
- 7.0.109 (Fedora linux 机器)
- 7.0.109 (Fedora linux 机器)
- 7.0.304(Windows 10 计算机)
- 7.0.306(Windows 11 计算机)
我尝试使用带有版本的 nuget 为每台机器提供相同的编译器版本,但同样,所有机器都使用它运行良好,GH 操作失败并出现相同的错误。Microsoft.Net.Compilers.Toolset
4.6.0
我试图分析我附加到每个 GH 操作运行的内容,但我没有找到任何可以指明我解决这个问题的方向,但我又不擅长分析.msbuild.binlog
binlog
答: 暂无答案
评论