Loading...
C# projects lean heavily on dependency injection and middleware pipelines, making flag references hard to trace manually. FlagShark ships a Roslyn analyzer that surfaces every `BoolVariation` call at build time and maps it to your LaunchDarkly project.
FlagShark generates a PR that removes the dead branch and keeps only the winning code path
[ApiController]
[Route("api/[controller]")]
public class SearchController : ControllerBase
{
private readonly ILdClient _ldClient;
public SearchController(ILdClient ldClient) => _ldClient = ldClient;
[HttpGet]
public async Task<IActionResult> Search([FromQuery] string q)
{
var ctx = Context.Builder(User.Identity!.Name!).Build();
var useFuzzy = _ldClient.BoolVariation("fuzzy-search", ctx, false);
if (useFuzzy)
return Ok(await _fuzzySearchService.SearchAsync(q));
return Ok(await _exactSearchService.SearchAsync(q));
}
}[ApiController]
[Route("api/[controller]")]
public class SearchController : ControllerBase
{
[HttpGet]
public async Task<IActionResult> Search([FromQuery] string q)
{
return Ok(await _fuzzySearchService.SearchAsync(q));
}
}FlagShark uses Roslyn analyzers for .NET SDK pattern detection to find every call to variation(), variationDetail(), boolVariation(), stringVariation()across your .NET, ASP.NET Core codebase.
Each detected flag key is matched against your LaunchDarkly project to check rollout status, last evaluation date, and whether the flag is archived or still active.
For each stale flag, FlagShark creates a pull request that removes the SDK call, eliminates the dead code branch, and preserves the winning path. Every PR includes a before/after diff you can review.
The .NET DI container often registers the LaunchDarkly client as a singleton behind `ILdClient` — after removing all flags, you need to also clean up the service registration in `Program.cs` or `Startup.cs` to avoid shipping an unused SDK dependency.
Grep misses flags behind abstractions. AST-level scanning catches SDK calls that regex can't.
Every cleanup goes through code review. No surprises, no broken builds.
Only flags at 100% rollout for your configured threshold are suggested for removal.
New stale flags are detected automatically. Your codebase stays clean without manual audits.
variation()variationDetail()boolVariation()stringVariation()Plus custom patterns you define in .flagshark.yaml
FlagShark includes a Roslyn analyzer that runs during your build. It detects all invocations of `BoolVariation`, `StringVariation`, and `JsonVariation` on `ILdClient`, traces them through DI constructor injection, and reports which flag keys are active.
Yes. FlagShark recognizes flag checks in both Blazor Server and Blazor WebAssembly components, including those injected via `@inject` directives and cascading parameters.
FlagShark traces flag usage through the middleware pipeline, including custom middleware classes and extension methods on `IApplicationBuilder`. It generates safe removal diffs that preserve your request pipeline order.
Connect your repo, see stale flags in minutes, and get cleanup PRs automatically.
Free tier available • No credit card required • 5-minute setup
A hands-on guide to finding and safely removing stale LaunchDarkly feature flags from TypeScript and React codebases.
Step-by-step process for identifying and removing dead LaunchDarkly flags in Django, FastAPI, and Flask applications.
How to find, evaluate, and remove unused LaunchDarkly feature flags from Go microservices and CLI tools.
Practical guide to removing stale LaunchDarkly flags from Spring Boot and Micronaut applications.
Find and safely remove LaunchDarkly feature flags buried in Rails controllers, views, and background jobs.
Leverage Rust's type system and FlagShark's syn-based analysis to remove stale LaunchDarkly flags from Actix and Axum services.