Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
Resolve AOT warning in DependencyInjection ExpressionResolverBuilder
Calling Expression.Lambda without a delegate type isn't AOT compatible. Fix this by passing the delegate type.
  • Loading branch information
eerhardt authored and github-actions committed Sep 10, 2024
commit f4b8f1891c0e789373613a1afe858d0ee47bf718
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal sealed class ExpressionResolverBuilder : CallSiteVisitor<object?, Expre

private static readonly ParameterExpression CaptureDisposableParameter = Expression.Parameter(typeof(object));
private static readonly LambdaExpression CaptureDisposable = Expression.Lambda(
delegateType: typeof(Func<object?, object?>),
Expression.Call(ScopeParameter, ServiceLookupHelpers.CaptureDisposableMethodInfo, CaptureDisposableParameter),
CaptureDisposableParameter);

Expand Down
Loading