Skip to content

Commit d91d59c

Browse files
committed
Fix for linker errors
1 parent 7019eda commit d91d59c

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

src/Components/Forms/src/FieldIdentifier.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private static void ParseAccessor<T>(Expression<Func<T>> accessor, out object mo
126126
// so, given that it embeds captured values such as "this". We could consider special-casing
127127
// for "() => something.Member" and building a cache keyed by "something.GetType()" with values
128128
// of type Func<object, object> so we can cheaply map from "something" to "something.Member".
129-
var modelLambda = Expression.Lambda(memberExpression.Expression);
129+
var modelLambda = Expression.Lambda(typeof(Func<object?>), memberExpression.Expression);
130130
var modelLambdaCompiled = (Func<object?>)modelLambda.Compile();
131131
var result = modelLambdaCompiled() ??
132132
throw new ArgumentException("The provided expression must evaluate to a non-null value.");
@@ -201,7 +201,7 @@ static Func<object, object> CreateAccessor((Type model, MemberInfo member) arg)
201201
private static object GetModelFromIndexer(Expression methodCallExpression)
202202
{
203203
object model;
204-
var methodCallObjectLambda = Expression.Lambda(methodCallExpression!);
204+
var methodCallObjectLambda = Expression.Lambda(typeof(Func<object?>), methodCallExpression!);
205205
var methodCallObjectLambdaCompiled = (Func<object?>)methodCallObjectLambda.Compile();
206206
var result = methodCallObjectLambdaCompiled();
207207
if (result is null)

src/SignalR/server/Core/src/DynamicHub.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics.CodeAnalysis;
45
namespace Microsoft.AspNetCore.SignalR;
56

67
/// <summary>
78
/// A base class for SignalR hubs that use <c>dynamic</c> to represent client invocations.
89
/// </summary>
10+
[RequiresDynamicCode("DynamicHub requires dynamic code generation to construct a call site.")]
911
public abstract class DynamicHub : Hub
1012
{
1113
private DynamicHubClients? _clients;

src/SignalR/server/Core/src/DynamicHubClients.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics.CodeAnalysis;
45
using Microsoft.AspNetCore.SignalR.Internal;
56

67
namespace Microsoft.AspNetCore.SignalR;
78

89
/// <summary>
910
/// A class that provides <c>dynamic</c> access to connections, including the one that sent the current invocation.
1011
/// </summary>
12+
[RequiresDynamicCodeAttribute("DynamicHubClient requires dynamic code generation to construct a call site.")]
1113
public class DynamicHubClients
1214
{
1315
private readonly IHubCallerClients _clients;

src/SignalR/server/Core/src/Internal/DynamicClientProxy.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics.CodeAnalysis;
45
using System.Dynamic;
56

67
namespace Microsoft.AspNetCore.SignalR.Internal;
@@ -9,6 +10,7 @@ internal sealed class DynamicClientProxy : DynamicObject
910
{
1011
private readonly IClientProxy _clientProxy;
1112

13+
[RequiresDynamicCodeAttribute("This constructor requires dynamic code generation to construct a call site.")]
1214
public DynamicClientProxy(IClientProxy clientProxy)
1315
{
1416
_clientProxy = clientProxy;

0 commit comments

Comments
 (0)