📄 Poc/Program.cs
using System;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using Microsoft.Build.Locator;
using Microsoft.CodeAnalysis.MSBuild;
using Reacher;
using Reacher.Poc;

MSBuildLocator.RegisterDefaults();

using var workspace = MSBuildWorkspace.Create();
var solution = await workspace.OpenSolutionAsync(GetSolutionPath());

ITestInterface test = new TestImplementation();
test.Test();

Noop();

var analysis = args is []
    ? await solution.AnalyzeReachabilityFromEntryPoints(default)
    : await solution.AnalyzeReachabilityFromDocumentationCommentIds(args, default);

Console.WriteLine("Reachable members:");
foreach (
    var r in analysis.ReachableMembers.Where(r =>
        r.ReachabilityConfidence is ReachabilityConfidence.DefinitelyReachable
    )
)
{
    Console.WriteLine($"\t{r.Member.GetDocumentationCommentId()}");
}
Console.WriteLine("Probably reachable members:");
foreach (
    var r in analysis.ReachableMembers.Where(r => r.ReachabilityConfidence is ReachabilityConfidence.ProbablyReachable)
)
{
    Console.WriteLine($"\t{r.Member.GetDocumentationCommentId()}");
}
Console.WriteLine("Unreachable members:");
foreach (var member in analysis.UnreachableMembers)
{
    Console.WriteLine($"\t{member.GetDocumentationCommentId()}");
}

return;

#pragma warning disable CS0162 // Intentionally unreachable
Unreachable();
#pragma warning restore CS0162

static string GetSolutionPath([CallerFilePath] string sourcePath = null!) =>
    Path.GetFullPath(Path.Join(Path.GetDirectoryName(sourcePath), @"..\Reacher.slnx"));

static void Noop() => TransitiveNoop();

static void TransitiveNoop() { }

static void Unreachable() => Unreachable();

static void Unused() => Unused();