Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Components/Forms/src/FieldIdentifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private static void ParseAccessor<T>(Expression<Func<T>> accessor, out object mo
// so, given that it embeds captured values such as "this". We could consider special-casing
// for "() => something.Member" and building a cache keyed by "something.GetType()" with values
// of type Func<object, object> so we can cheaply map from "something" to "something.Member".
var modelLambda = Expression.Lambda(memberExpression.Expression);
var modelLambda = Expression.Lambda(typeof(Func<object?>), memberExpression.Expression);
var modelLambdaCompiled = (Func<object?>)modelLambda.Compile();
var result = modelLambdaCompiled() ??
throw new ArgumentException("The provided expression must evaluate to a non-null value.");
Expand Down Expand Up @@ -201,7 +201,7 @@ static Func<object, object> CreateAccessor((Type model, MemberInfo member) arg)
private static object GetModelFromIndexer(Expression methodCallExpression)
{
object model;
var methodCallObjectLambda = Expression.Lambda(methodCallExpression!);
var methodCallObjectLambda = Expression.Lambda(typeof(Func<object?>), methodCallExpression!);
var methodCallObjectLambdaCompiled = (Func<object?>)methodCallObjectLambda.Compile();
var result = methodCallObjectLambdaCompiled();
if (result is null)
Expand Down
2 changes: 2 additions & 0 deletions src/SignalR/server/Core/src/DynamicHub.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
namespace Microsoft.AspNetCore.SignalR;

/// <summary>
/// A base class for SignalR hubs that use <c>dynamic</c> to represent client invocations.
/// </summary>
[RequiresDynamicCode("DynamicHub requires dynamic code generation to construct a call site.")]
public abstract class DynamicHub : Hub
{
private DynamicHubClients? _clients;
Expand Down
2 changes: 2 additions & 0 deletions src/SignalR/server/Core/src/DynamicHubClients.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.SignalR.Internal;

namespace Microsoft.AspNetCore.SignalR;

/// <summary>
/// A class that provides <c>dynamic</c> access to connections, including the one that sent the current invocation.
/// </summary>
[RequiresDynamicCodeAttribute("DynamicHubClient requires dynamic code generation to construct a call site.")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: DynamicHubClients

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know what changed that required these?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was a result of dotnet/runtime#107638 getting merged.

public class DynamicHubClients
{
private readonly IHubCallerClients _clients;
Expand Down
2 changes: 2 additions & 0 deletions src/SignalR/server/Core/src/Internal/DynamicClientProxy.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using System.Dynamic;

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

[RequiresDynamicCodeAttribute("This constructor requires dynamic code generation to construct a call site.")]
public DynamicClientProxy(IClientProxy clientProxy)
{
_clientProxy = clientProxy;
Expand Down