Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions tests/cases/csharp/unmodelled-entry-not-local/case.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,29 @@
"lang": "csharp",
"checks": [
{
"why": "--delete on a hosted service says a framework calls it, not the dead-code verdict (#1446)",
"run": ["impact", "SweepWorker", "--kind", "type", "--delete"],
"want": ["NOT SAFE", "it extends / implements BackgroundService, which the graph does not contain", "Program.<Main>$ src/App/Program.cs:2 — ", "names it (METHOD_TYPE_ARGUMENT)"],
"why": "--delete on a hosted service the graph sees no registration for says a framework calls it, not the dead-code verdict (#1446)",
"run": ["impact", "IdleWorker", "--kind", "type", "--delete"],
"want": ["NOT SAFE TO ASSUME", "it extends / implements BackgroundService, which the graph does not contain"],
"avoid": ["· nothing", "no dependent at any certainty in this graph. Before deleting"]
},
{
"why": "--delete on the hosted service's method says the same (#1446)",
"run": ["impact", "SweepWorker.ExecuteAsync", "--delete"],
"why": "--delete on that hosted service's method says the same (#1446)",
"run": ["impact", "IdleWorker.ExecuteAsync", "--delete"],
"want": ["NOT SAFE TO ASSUME", "a framework calls it"],
"avoid": ["· nothing"]
},
{
"why": "a hosted service AddHostedService<T>() registers: the registration is a dependent, so the verdict is NOT SAFE and names the site",
"run": ["impact", "SweepWorker", "--kind", "type", "--delete"],
"want": ["NOT SAFE — 1 callable(s) call or receive it", "Program.<Main>$ src/App/Program.cs:2 — ", "names it (METHOD_TYPE_ARGUMENT)"],
"avoid": ["· nothing", "NOT SAFE TO ASSUME", "no dependent at any certainty in this graph. Before deleting"]
},
{
"why": "the registered hosted service's method: the registration site hands it to the framework, so it is not dead code",
"run": ["impact", "SweepWorker.ExecuteAsync", "--delete"],
"want": ["NOT SAFE — 1 callable(s) call or receive it", "[registered] Program.<Main>$ src/App/Program.cs:2"],
"avoid": ["· nothing", "NOT SAFE TO ASSUME"]
},
{
"why": "control: a type nothing registers, with no library base, keeps the dead-code verdict",
"run": ["impact", "Unused", "--kind", "type", "--delete"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ public void OnOrder(string body) { }
[Obsolete]
public void Legacy() { }
}

// a hosted service no registration in the graph names
public sealed class IdleWorker : BackgroundService
{
protected override Task ExecuteAsync(CancellationToken t) => Task.CompletedTask;
}
Loading