Agents In Use
What’s new todayLast update
108 use cases added today

How to use GitHub Copilot to clean .NET conditionals

Copilot removed obsolete .NET version conditionals using file-specific rules, preserving Framework and Standard branches as maintainers reviewed the cleanup.

FROM THE SOURCE

Original prompt

Shared by the source author. See source notes for context.

This repo no longer builds for .NET Core versions older than 10.

Evidence at a glance

Sourced account
Original account
Read the source ↗
Published
Source link checked
Reported result
Copilot removed obsolete .NET version conditionals using file-specific rules, preserving Framework and Standard branches as maintainers reviewed the cleanup; the pull request merged into dotnet/runtime main.
Human involvement
Human provided transformation strategy and reviewed/merged.

A linked account supports attribution. It does not mean we independently reproduced its result.

Report an issue with this caseOpen correction email

Opens your email app with the case link included. Nothing is sent automatically.

How the agent did it

  1. Distinguished runtime-only from multi-targeted files.
  2. Replaced obsolete version constants with NET where needed.
  3. Removed unconditional branches and refreshed tests/baselines.

Stephen Toub assigned GitHub Copilot a repository cleanup after dotnet/runtime stopped building for .NET Core versions older than 10. NET9_0_OR_GREATER and NET10_0_OR_GREATER had become redundant, but removing them required understanding which files also served other target frameworks.

The prompt supplied a transformation strategy. Runtime-only code could lose unnecessary branches, while files shared with .NET Framework or .NET Standard still needed the broader NET distinction. Copilot applied file-specific rules across core libraries, supporting packages, reference assemblies and tests. It also repaired formatting affected by removed directives and updated baseline files.

The PR's description makes the distinction explicit: code in netcore-only locations becomes unconditional, while shared compilation paths retain conditional behavior. This prevented the cleanup from becoming a blind text replacement that would erase still-relevant framework differences.

Toub reviewed the resulting changes and merged the pull request on January 7, 2026. The account demonstrates delegated mechanical editing guided by a maintainer's repository knowledge, not an autonomous decision to drop platform support.

Prompt
Original prompt

Source: GitHub · Copilot (on behalf of stephentoub)

Frequently asked questions

Why had the version checks become obsolete?

The repository no longer built for .NET Core versions older than 10, making those two version-specific conditions redundant.

Why not delete every conditional?

Some files also compile for .NET Framework or .NET Standard, so the distinction between NET and those targets still mattered.

How did Copilot scope the transformations?

It applied separate rules to runtime-only code, netcore-only files, shared files and tests, following the supplied maintainer strategy.

More details

About this account

GitHub Copilot investigated or implemented the scoped repository task and produced a pull request, with work and checks recorded for maintainer review.

Primary pull request and public API timeline opened and checked on 2026-10-14. PR creation date is the original publication date; merge dates are separate result evidence. Not a blind replace: .NET Framework/Standard branches still matter. Outcomes and test claims are attributed to the source and were not independently reproduced. Original prompt excerpt: reproduced verbatim from the public PR prompt; the full task contains additional context.

Credit: Copilot (on behalf of stephentoub) on GitHub

Source published

Added to Agents In Use

Source checked

Tools and topics

GitHub Copilot · .NET · Git · GitHub

Code cleanup · Conditional compilation · .NET

Editorial completeness: 100/100. Measures documented fields, not agent performance or verified outcomes.