Skip to content

Commit 01f1883

Browse files
cstoneerhardt
authored andcommitted
Add missing [RequiresDynamicCode] attributes to System.Linq.Expressions API in ref assembly (dotnet#107580)
dotnet#94069 added new attributes to System.Linq.Expressions public APIs for [RequiresDynamicCode(Expression.DelegateCreationRequiresDynamicCode)]. But these attributes never made it into the ref assemblies. This adds the attributes to the ref assemblies. * dotnet build /t:GenerateReferenceAssemblySource * build ... /p:ApiCompatGenerateSuppressionFile=true * Update link * Resolve AOT warning in DependencyInjection ExpressionResolverBuilder Calling Expression.Lambda without a delegate type isn't AOT compatible. Fix this by passing the delegate type. --------- Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
1 parent 16a9340 commit 01f1883

3 files changed

Lines changed: 57 additions & 311 deletions

File tree

src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/Expressions/ExpressionResolverBuilder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ internal sealed class ExpressionResolverBuilder : CallSiteVisitor<object?, Expre
3232

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

0 commit comments

Comments
 (0)