Skip to content

Show a warning when the tools are used with a platform-specific app#37868

Merged
AndriySvyryd merged 7 commits intomainfrom
copilot/show-warning-for-platform-apps
Mar 25, 2026
Merged

Show a warning when the tools are used with a platform-specific app#37868
AndriySvyryd merged 7 commits intomainfrom
copilot/show-warning-for-platform-apps

Conversation

Copy link
Contributor

Copilot AI commented Mar 6, 2026

Fixes #32835

EF tools can fail with an unhelpful exceptions when used with platform-specific apps (e.g., WinUI 3 targeting net8.0-windows10.0.19041.0).

  • src/dotnet-ef/RootCommand.cs: A warning is now always emitted via Reporter.WriteWarning when the startup project's TargetPlatformIdentifier is not null/empty, or when the TargetFramework is in platform-specific netX.Y-Z form (e.g., net8.0-windows10.0.19041.0). The warning message always includes the TargetFramework value. Added HasPlatformInTargetFramework helper to detect the netX.Y-Z TFM pattern.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

… app

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI changed the title [WIP] Add warning for tools in platform-specific apps Show a warning when the tools are used with a platform-specific app Mar 6, 2026
…ution platform

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
…urrentPlatform

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
…m TargetFramework

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
…ct message with docs link and IDesignTimeDbContextFactory<> guidance

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/efcore/sessions/6e12c379-3c85-4c7e-a45c-5ed92f003975
…getFramework in message

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/efcore/sessions/aeeadad5-f2cb-43c0-bb20-80f4134a585d
Copilot AI requested a review from AndriySvyryd March 25, 2026 00:27
@AndriySvyryd AndriySvyryd marked this pull request as ready for review March 25, 2026 00:31
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner March 25, 2026 00:31
Copilot AI review requested due to automatic review settings March 25, 2026 00:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a user-facing warning in the dotnet-ef tool when the startup project targets a platform-specific TFM (e.g., net8.0-windows10.0.19041.0), to help users understand why design-time tooling may not behave as expected for certain app types.

Changes:

  • Emit a warning via Reporter.WriteWarning when TargetPlatformIdentifier is set or when the startup project TargetFramework contains a platform suffix (netX.Y-Z form).
  • Add a helper method to detect platform suffixes in TFMs.
  • Introduce a new localized resource string for the warning message.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/dotnet-ef/RootCommand.cs Emits the new platform-specific startup project warning and adds TFM platform detection helper.
src/dotnet-ef/Properties/Resources.resx Adds the new warning message text as a localized resource.
src/dotnet-ef/Properties/Resources.Designer.cs Adds the strongly-typed accessor for the new resource string.
Files not reviewed (1)
  • src/dotnet-ef/Properties/Resources.Designer.cs: Language not supported

@roji roji assigned AndriySvyryd and unassigned roji Mar 25, 2026
@AndriySvyryd AndriySvyryd merged commit bfad1f2 into main Mar 25, 2026
17 checks passed
@AndriySvyryd AndriySvyryd deleted the copilot/show-warning-for-platform-apps branch March 25, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show a warning when the tools are used with a platform-specific app

4 participants