Closed mikeholczer closed 4 months ago
Could you provide full reproducible code?
Well, I’m not able to recreate the issue in a simple sample app I created for the purpose. I’ll have to start making it more and more like my real app, and see when the issue reproduces. I should have done that to start off. I think I’ll have time tomorrow for that.
So, I think I figured out what my problem is which is it doesn't work if I use a command class that's declared in another project.
If I add a project to my solution, add a project refence in the console app to it. I just created this follow class in the other project and if I use that as the generic type on the call to .Add
using System;
namespace ClassLibrary1
{
public class Class1
{
public void TestMethod()
{
Console.WriteLine("testing");
}
}
}
As soon as I move that class to the console app project, it all works.
Thank you. Due to limitations of the Source Generator, it is not possible to obtain the SyntaxTree of the referenced project. It seems that it is impossible to process it all because the ConsoleAppFramework also obtains information from the SyntaxTree (DocComment).
I've made the Analyzer output errors for now(v5.2.3).
Things are working as expected when I specify commands with lambdas, but when I try to use the .Add() method to specify commands in a class, nothing happens when I run the application. I can't even get --help or --version to work. When debugging, it seems as though the ConsoleApp.Builder.g.cs file isn't getting compiled in, as the debugger just skips over the line calling it in ConsoleApp.cs's
ConsoleAppFramework.ConsoleApp.ConsoleAppBuilder.RunAsync(string[] args)
. Like it's no seeing the other side of the partial method.When I comment out the .Add() call, it works again. Any ideas what I'm doing wrong?