![](/img/trans.png)
[英]C# source generators: How to debug compiler errors in the generated code?
[英]C# Source Generators debug in vscode
如何在使用 vscode 的构建过程中调试ISourceGenerator
代码? 网络上的示例使用Debugger.Launch()
但这仅适用于 Visual Studio。
[Generator]
public class HelloWorldGenerator : ISourceGenerator
{
public void Execute(GeneratorExecutionContext context)
{
}
public void Initialize(GeneratorInitializationContext context)
{
if (!Debugger.IsAttached)
{
// how to make it break here?
Debugger.Launch();
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.