autofac / autofac/Autofac

Support Delegate Factories when compiled in AOT mode

Closed
#1,449 2 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
C#
Stars
4.7k
Forks
846
Avg merge
1d 12m
Merged PRs (30d)
2

Description

## Problem Statement
Using delegate factories in Autofac when AOT mode is on causes exceptions because it emits JIT compiled methods. I was not sure whether to open this as a bug or not as I didn't know if it is a supported use case. At the very least, this documentation page https://autofac.readthedocs.io/en/latest/advanced/delegate-factories.html could be updated to state that AOT is not supported.

## Desired Solution
Frankly, I'm not sure if its possible to easily support this use case, but perhaps it can be done by generated source code. The desired solution is that delegate factories would work in AOT mode.

## Alternatives You've Considered
We could refactor our code base to manually resolve these dependencies but we loose a lot of flexibility.

## Additional Context
This problem was discovered when deploying a iOS app in release mode

Contributor guide

Open the contributing guide

Research direction

Start with the advanced/delegate-factories.html documentation page and reproduce the delegate-factory exception when Autofac is compiled in AOT mode for an iOS release deployment. Determine whether generated source code can support this use case; done means delegate factories work under AOT, or the documentation clearly states that AOT is unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, ios
Domain
mobile-dev, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.