Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Delegate Factories when compiled in AOT mode #1449

Open
jhimes144 opened this issue Mar 26, 2025 · 1 comment
Open

Support Delegate Factories when compiled in AOT mode #1449

jhimes144 opened this issue Mar 26, 2025 · 1 comment

Comments

@jhimes144
Copy link

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

@tillig
Copy link
Member

tillig commented Mar 26, 2025

I think we have some reflection support for AOT but we can always use help adding more. I don't personally do any AOT work and we've had a bit of a dry spell for PRs - we'd love to get some help adding this support if you're willing to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants