Apple platform
Mac Catalyst
Framework version
net11.0-*
Affected platform version
macOS 26.5.2 arm64; Xcode 26.5; SDK 11.0.100-preview.7.26381.103; workload 11.0.100-preview.7.26410.2
Description
A stock .NET 11 Preview 7 MAUI Mac Catalyst Debug application using the matching EF Core 11 Preview 7 SQLite package cannot create or use a normal DbContext.
The first call to Database.EnsureCreatedAsync() throws:
System.InvalidOperationException: Model building is not supported when publishing with NativeAOT. Use a compiled model.
The application is not published with NativeAOT (PublishAot is not set). The app bundle contains libcoreclr.dylib, and the runtime reports:
RuntimeFeature.IsDynamicCodeSupported == false
RuntimeFeature.IsDynamicCodeCompiled == false
This appears to put EF Core into its NativeAOT-only path even though this is a normal CoreCLR Debug application. It blocks existing EF Core + SQLite MAUI applications from moving to net11.0-maccatalyst, and Preview 6 removed the Mono runtime fallback.
The attached project is a synthetic stock-template reproduction with one entity and no application-specific code. It uses:
- SDK
11.0.100-preview.7.26381.103
- workload set
11.0.100-preview.7.26410.2
- MAUI
11.0.0-preview.7.26406.9
- EF Core SQLite
11.0.0-preview.7.26381.103
maccatalyst-arm64
Expected: a non-NativeAOT Debug application can build its EF model and execute ordinary EF queries through the CoreCLR interpreter, as the equivalent .NET 10/Mono application can.
Actual: EF immediately treats the process as NativeAOT and refuses runtime model creation.
Possibly related runtime work:
The latter explicitly discusses supporting expression-tree compilation, DynamicMethod, and Reflection.Emit through the CoreCLR interpreter on Apple mobile. Should IsDynamicCodeSupported be true for that supported interpreter path, or does EF need another way to distinguish CoreCLR-interpreted MAUI from NativeAOT?
DotNet11EfCoreMacCatalystRepro.zip
Steps to Reproduce
-
Install .NET SDK 11.0.100-preview.7.26381.103 and workload set 11.0.100-preview.7.26410.2.
-
Extract the attached DotNet11EfCoreMacCatalystRepro.zip.
-
From the extracted directory, run:
dotnet build -c Debug -f net11.0-maccatalyst
./bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/DotNet11EfCoreMacCatalystRepro.app/Contents/MacOS/DotNet11EfCoreMacCatalystRepro
-
The app catches and displays the exception and also writes it to stderr.
The repro calls only EnsureCreatedAsync, SaveChangesAsync, and a simple OrderBy(...).FirstAsync(). It fails on EnsureCreatedAsync while EF retrieves the model.
Did you find any workaround?
Remain on net10.0-maccatalyst/Mono.
Generating a compiled model is not a complete workaround for a real application: in a separate larger validation it got past initial model discovery, but EnsureCreatedAsync then failed because design-time model operations are unavailable, and ordinary queries failed because they were not precompiled. Supporting that path would require compiled models, precompiled queries, and replacing runtime schema initialization. The Mono selection property is no longer available in .NET 11 Preview 6+.
Relevant logs
FAIL
.NET 11.0.0-preview.7.26381.103; dynamic supported=False; dynamic compiled=False
System.InvalidOperationException: Model building is not supported when publishing with NativeAOT. Use a compiled model.
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel(Boolean designTime)
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
...
at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreatedAsync(CancellationToken cancellationToken)
at DotNet11EfCoreMacCatalystRepro.MainPage.RunReproAsync(...) in MainPage.xaml.cs:line 29
.NET SDK: 11.0.100-preview.7.26381.103 (arm64)
.NET runtime: 11.0.0-preview.7.26381.103
Workload set: 11.0.100-preview.7.26410.2
MAUI manifest: 11.0.0-preview.7.26406.9
macOS: 26.5.2 (25F84)
Xcode: 26.5 (17F42)
RID: maccatalyst-arm64
Configuration: Debug
PublishAot: not set
Apple platform
Mac Catalyst
Framework version
net11.0-*
Affected platform version
macOS 26.5.2 arm64; Xcode 26.5; SDK 11.0.100-preview.7.26381.103; workload 11.0.100-preview.7.26410.2
Description
A stock .NET 11 Preview 7 MAUI Mac Catalyst Debug application using the matching EF Core 11 Preview 7 SQLite package cannot create or use a normal
DbContext.The first call to
Database.EnsureCreatedAsync()throws:The application is not published with NativeAOT (
PublishAotis not set). The app bundle containslibcoreclr.dylib, and the runtime reports:This appears to put EF Core into its NativeAOT-only path even though this is a normal CoreCLR Debug application. It blocks existing EF Core + SQLite MAUI applications from moving to
net11.0-maccatalyst, and Preview 6 removed the Mono runtime fallback.The attached project is a synthetic stock-template reproduction with one entity and no application-specific code. It uses:
11.0.100-preview.7.26381.10311.0.100-preview.7.26410.211.0.0-preview.7.26406.911.0.0-preview.7.26381.103maccatalyst-arm64Expected: a non-NativeAOT Debug application can build its EF model and execute ordinary EF queries through the CoreCLR interpreter, as the equivalent .NET 10/Mono application can.
Actual: EF immediately treats the process as NativeAOT and refuses runtime model creation.
Possibly related runtime work:
The latter explicitly discusses supporting expression-tree compilation,
DynamicMethod, andReflection.Emitthrough the CoreCLR interpreter on Apple mobile. ShouldIsDynamicCodeSupportedbe true for that supported interpreter path, or does EF need another way to distinguish CoreCLR-interpreted MAUI from NativeAOT?DotNet11EfCoreMacCatalystRepro.zip
Steps to Reproduce
Install .NET SDK
11.0.100-preview.7.26381.103and workload set11.0.100-preview.7.26410.2.Extract the attached
DotNet11EfCoreMacCatalystRepro.zip.From the extracted directory, run:
The app catches and displays the exception and also writes it to stderr.
The repro calls only
EnsureCreatedAsync,SaveChangesAsync, and a simpleOrderBy(...).FirstAsync(). It fails onEnsureCreatedAsyncwhile EF retrieves the model.Did you find any workaround?
Remain on
net10.0-maccatalyst/Mono.Generating a compiled model is not a complete workaround for a real application: in a separate larger validation it got past initial model discovery, but
EnsureCreatedAsyncthen failed because design-time model operations are unavailable, and ordinary queries failed because they were not precompiled. Supporting that path would require compiled models, precompiled queries, and replacing runtime schema initialization. The Mono selection property is no longer available in .NET 11 Preview 6+.Relevant logs