Skip to content

Document that delegate factories require runtime code generation - #219

Merged
tillig merged 1 commit into
mainfrom
feature/issue-1449-aot-delegate-factories
Sep 15, 2026
Merged

tillig merged 1 commit into
mainfrom
feature/issue-1449-aot-delegate-factories

Conversation

@tillig

@tillig tillig commented Sep 15, 2026

Copy link
Copy Markdown
Member

Relates to autofac/Autofac#1449

Delegate factories compile an expression tree the first time the factory type is resolved, so they throw under Mono full AOT - the mode iOS and MAUI release builds use. Supporting them there would mean replacing the expression tree with source generation, which we are not planning to do, so the limitation is documented instead.

Proposed Changes

  • Add an "AOT and Runtime Code Generation" section to the delegate factories page explaining why the feature needs a JIT and where that fails.
  • Record the ExecutionEngineException text verbatim, since the exception names a generated dynamic method rather than anything recognizable, and someone hitting it has nothing better to search for.
  • Show the explicit Resolve with NamedParameter that replaces the factory, matching the by-name parameter semantics delegate factories use.
  • Mention the Mono interpreter as an alternative, with its app-wide performance cost, and cross-reference the Native AOT and trimming page.

Notes

doc8 and sphinx-build -W both pass.

Scoped to Mono full AOT deliberately. The repo's AOT smoke test covers parameterless Func<T> under .NET Native AOT and it passes, so this does not claim the feature is broken everywhere - the existing Native AOT page already carries the general picture and is left alone.

Delegate factories compile an expression tree when the factory type is first
resolved, so they fail under Mono full AOT - the mode iOS and MAUI release
builds use. There is no fix short of full source generation, so the page now
records the exception verbatim for searchability and shows the explicit
resolve that replaces the factory.
@tillig
tillig merged commit 21222ca into main Sep 15, 2026
2 checks passed
@tillig
tillig deleted the feature/issue-1449-aot-delegate-factories branch September 15, 2026 20:47
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.

1 participant