dotnet / dotnet/sdk

`dotnetup install sdk preview` fails when no preview version is available for latest

Open
#52,675 1 comment 1 reaction 2 assignees Claimed by @nagilson View on GitHub
Area-dotnetup Cost:S untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

# Preview channel should fall back to latest GA when no previews are available

## Summary

When a user requests the `preview` channel but no preview releases are currently available, `dotnetup` should install the latest GA (General Availability) version with a warning, rather than failing or installing an outdated preview from a previous major version.

## Background

There is a window each year (typically November through February) where no preview releases exist:
- The current major version (e.g., .NET 10) has gone GA
- The next major version's previews (e.g., .NET 11) haven't started yet

During this window, a user running `dotnetup sdk install --channel preview` will get no result.

**Related test (currently skipped for this reason):**
https://github.com/dotnet/sdk/blob/nagilson-dnup-install-runtimes-impl/test/dotnetup.Tests/ChannelVersionResolverTests.cs#L78-L99

## Current Behavior

When no preview releases are available, the `preview` channel resolution returns `null`, which would cause the installation to fail.

## Proposed Behavior

When the `preview` channel is requested but no preview releases exist:

1. **Fall back to the latest GA version** - Install the newest stable release
2. **Emit a warning** explaining what happened:
```
Warning: No preview releases are currently available. Installing the latest GA version (10.0.102) instead.
Preview releases for .NET 11 will be available starting around February 2026.
```

## Why this is better than installing an older preview

An alternative approach would be to find the most recent preview release from *any* version (e.g., .NET 10 Preview 7 from October 2025). This is **not recommended** because:

1. **Older previews are superseded by GA** - .NET 10 Preview 7 is strictly worse than .NET 10 GA in every way
2. **Preview users want the bleeding edge** - They're seeking the newest features, not outdated pre-release software
3. **Security and stability** - GA releases have all the fixes that previews were missing
4. **Semantic expectation** - "preview" implies "ahead of stable," not "behind stable"

## Design Questions

1. **Should the fallback be opt-in?**
- Option A: Always fall back with a warning (recommended)
- Option B: Require `--allow-fallback` flag
- Option C: Prompt interactively in interactive mode

2. **Should we predict when previews will be available?**
- We could provide an approximate date based on the typical .NET release cadence
- Risk: Dates may change, leading to incorrect information

3. **Should `--channel preview` with `--no-fallback` fail explicitly?**
- This would let CI/CD pipelines detect when previews aren't available

## Acceptance Criteria

- [ ] `dotnetup sdk install --channel preview` installs latest GA when no previews exist
- [ ] A clear warning is emitted explaining the fallback
- [ ] The skipped test can be updated to verify this behavior year-round
- [ ] Documentation updated to explain this behavior

## Related

- Test: [ChannelVersionResolverTests.cs#L78](https://github.com/nagilson/sdk/blob/nagilson-dnup-install-runtimes-impl/test/dotnetup.Tests/ChannelVersionResolverTests.cs#L78)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.