0

I'm not really sure where to begin so this question is likely to evolve as I receive feedback. That said, I'm upgrading our projects to .net 4.6.2. After updating nuget packages and resolving dependency issues, I'm finally able to build. However, during startup I'm now getting an exception that I can't solve. The Exception occurs way later due to a null value, but I've tracked the issue to a change to how an argument comes into a method.

This is the method with the argument that is different. The argument, expression, comes in differently depending on the .net version.

public static IInterfaceNameChanged CreateScreenRule<TInstance>(Expression<Func<TInstance, ScreenRule>> expression)
    where TInstance : new()
{
    return CreateNewable(expression, null, RuleSetBase.RuleSetTypes.Req);
}

This is the Call to CreateScreenRule():

RuleFactory.CreateScreenRule<VehicleDriverAssignment>(i => i.VehicleDriverAssignments)

And the method's Signature that we are trying to create:

public void VehicleDriverAssignments(ScreenRuleContext args)
{...}

Pre upgrade: expression argument comes into the method like this:

i => Convert(CreateDelegate(RuleEngine.ScreenRule, i, Void VehicleDriverAssignments(RuleEngine.ScreenRuleContext)))

Post Upgrade: it comes into the method like this:

i => Convert(Void VehicleDriverAssignments(RuleEngine.ScreenRuleContext).CreateDelegate(RuleEngine.ScreenRule, i))

None of the code has changed, the only thing that has changed is the upgrade and other upgrade related activities (nuget upgrades, binding redirects, etc.).

Any ideas why upgrading .net fundamentally changes how expression comes in?

thanks

DontThinkJustGo
  • 380
  • 2
  • 11

1 Answers1

0

I think I may have found the issue. looks like Expression Body has changed between these versions.

Expression Body Differences Between .NET 4 and .NET 4.6.2

DontThinkJustGo
  • 380
  • 2
  • 11