Skip to content

[mobile] .NET 11 mobile runtime configuration updates - #54713

Merged
kotlarmilos merged 6 commits into
mainfrom
dev/update-sdk-mobile
Jun 18, 2026
Merged

[mobile] .NET 11 mobile runtime configuration updates#54713
kotlarmilos merged 6 commits into
mainfrom
dev/update-sdk-mobile

Conversation

@kotlarmilos

@kotlarmilos kotlarmilos commented Jun 11, 2026

Copy link
Copy Markdown
Member

Description

Add build error NETSDK1242 so that building Android or Apple mobile projects with UseMonoRuntime=true on the .NET 11 SDK fails with a clear message directing users to the .NET 10 SDK, instead of a silent missing-pack error. Implemented via _CheckForUnsupportedMonoMobileRuntime in Microsoft.NET.TargetFrameworkInference.targets and the NETSDK1242 string (Strings.resx and 13 xlf translations).

Validation pipelines (must pass): dotnet-sdk-public PR build.

…n .NET 11

Add NETSDK1242 so building an Android or Apple mobile project with
UseMonoRuntime=true on net11.0 or later fails with a clear message directing
users to the .NET 10 SDK, instead of a silent missing-pack error. WebAssembly
Mono, CoreCLR, NativeAOT, and the platform workloads are unaffected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added Area-Infrastructure sdk-diagnostic-docs-needed Indicates that a PR introduces new diagnostic codes, which must be documented over at dotnet/docs labels Jun 11, 2026
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

📋 SDK Diagnostic Documentation Reminder

This PR introduces 1 new SDK diagnostic code:

  • NETSDK1242

Action Required

Please ensure that documentation for this diagnostic is added or updated in the dotnet/docs repository at:

Each diagnostic should have:

  • A clear description of the error/warning
  • Possible causes
  • Recommended solutions
  • Code examples where applicable

Thank you for helping keep our documentation up to date! 🙏

@jonathanpeppers jonathanpeppers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(sorry posted this on the wrong PR)

Comment thread src/Tasks/Common/Resources/Strings.resx Outdated
kotlarmilos and others added 2 commits June 16, 2026 13:47
Building with the .NET 10 SDK does not resolve the error when the project targets
.NET 11.0 or later, so the previous message was misleading. Point users at the two
real fixes: use the CoreCLR runtime, or target .NET 10.0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Gate the NETSDK1242 check on a private _DisableCheckForUnsupportedMonoMobileRuntime
property so a project can opt out during the transition. The escape hatch stops
working once the runtime packs are removed, which is acceptable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kotlarmilos
kotlarmilos marked this pull request as ready for review June 16, 2026 12:23

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.

Pull request overview

This PR adds an SDK build-time validation that emits a new error (NETSDK1242) when UseMonoRuntime=true is used for Android or Apple mobile TFMs on .NET 11.0+ (directing users to switch to CoreCLR or target .NET 10.0), avoiding later/less-clear missing-pack failures.

Changes:

  • Adds _CheckForUnsupportedMonoMobileRuntime to fail early for .NETCoreApp + UseMonoRuntime=true + net11.0+ + (android/ios/tvos/maccatalyst).
  • Introduces the new resource string MonoRuntimeNotSupportedForPlatform with error code NETSDK1242.
  • Updates all localized XLF files with the new trans-unit for NETSDK1242.
Show a summary per file
File Description
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets Adds early validation target that throws NETSDK1242 for unsupported Mono mobile runtime usage on net11.0+.
src/Tasks/Common/Resources/Strings.resx Adds MonoRuntimeNotSupportedForPlatform (NETSDK1242) and updates the “latest message added” guard comment.
src/Tasks/Common/Resources/xlf/Strings.cs.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.de.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.es.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.fr.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.it.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.ja.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.ko.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.pl.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.ru.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.tr.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).
src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf Adds localized entry placeholder for MonoRuntimeNotSupportedForPlatform (NETSDK1242).

Copilot's findings

  • Files reviewed: 15/15 changed files
  • Comments generated: 1

Comment thread src/Tasks/Common/Resources/xlf/Strings.cs.xlf
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
kotlarmilos and others added 2 commits June 17, 2026 09:00
The Czech xlf source text was not regenerated after the NETSDK1242
message was shortened, causing XliffTasks to fail the out-of-date check
across all build legs. Align the cs.xlf source with Strings.resx.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kotlarmilos

Copy link
Copy Markdown
Member Author

/ba-g #54864 #54869

@kotlarmilos
kotlarmilos merged commit 3c65c70 into main Jun 18, 2026
23 of 25 checks passed
@kotlarmilos
kotlarmilos deleted the dev/update-sdk-mobile branch June 18, 2026 16:47
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 23, 2026
@mthalman

Copy link
Copy Markdown
Member

This change prevents the ability to build the runtime repo with Mono runtime. See dotnet/source-build#5603

@jonathanpeppers

Copy link
Copy Markdown
Member

@mthalman I would set _DisableCheckForUnsupportedMonoMobileRuntime=true for now if you need unblocked.

@mthalman

Copy link
Copy Markdown
Member

@mthalman I would set _DisableCheckForUnsupportedMonoMobileRuntime=true for now if you need unblocked.

I can do that but this would be a breaking change for downstream source-build distro partners that need to build with Mono runtime. Unfortunately, this change made its way into the 11.0.1xx-preview6 branch of the VMR. We should really get this fixed or reverted for Preview 6.

@mthalman

Copy link
Copy Markdown
Member

@mthalman I would set _DisableCheckForUnsupportedMonoMobileRuntime=true for now if you need unblocked.

I can do that but this would be a breaking change for downstream source-build distro partners that need to build with Mono runtime. Unfortunately, this change made its way into the 11.0.1xx-preview6 branch of the VMR. We should really get this fixed or reverted for Preview 6.

Oh never mind. Not sure what I was thinking. _DisableCheckForUnsupportedMonoMobileRuntime should be a fine temporary workaround and will unblock downstream partners.

davidnguyen-tech added a commit to davidnguyen-tech/performance that referenced this pull request Jul 7, 2026
The .NET 11 SDK blocks UseMonoRuntime for mobile TFMs (NETSDK1242).
Pass /p:_DisableCheckForUnsupportedMonoMobileRuntime=true (the SDK's
supported opt-out, dotnet/sdk#54713) alongside UseMonoRuntime=true for
the Mono inner-loop variant so restore + build succeed on net11.0-ios.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Infrastructure sdk-diagnostic-docs-needed Indicates that a PR introduces new diagnostic codes, which must be documented over at dotnet/docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants