Skip to content

Make service provider context discovery best-effort in the tools - #39562

Open
ajcvickers wants to merge 1 commit into
dotnet:mainfrom
ajcvickers:fix/25053-best-effort-service-discovery
Open

ajcvickers wants to merge 1 commit into
dotnet:mainfrom
ajcvickers:fix/25053-best-effort-service-discovery

Conversation

@ajcvickers

Copy link
Copy Markdown
Contributor

When every DbContext found so far has an IDesignTimeDbContextFactory, the application service provider is only used to look for additional contexts. Failures there (for example, a null connection string thrown from Startup when DbContextOptions are resolved) no longer prevent the tools from using the factory contexts; a warning is reported instead. If any context lacks a factory, or none were found, the original error is still reported.

Fixes #25053

When every DbContext found so far has an IDesignTimeDbContextFactory, the
application service provider is only used to look for additional contexts.
Failures there (for example, a null connection string thrown from Startup
when DbContextOptions are resolved) no longer prevent the tools from using
the factory contexts; a warning is reported instead. If any context lacks a
factory, or none were found, the original error is still reported.

Fixes dotnet#25053

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ajcvickers
ajcvickers requested a review from a team as a code owner November 8, 2026 10:30
Copilot AI balanced review requested due to automatic review settings November 8, 2026 10:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrations script not using IDesignTimeDbContextFactory

2 participants