Skip to content

Commit 7e9d361

Browse files
committed
InvokeDirect no longer works in Propeller because of AssemblyLoadContext. I’m going to use BindingFlags.DoNotWrapExceptions instead, although this requires netstandard >= 2.1, which means we are now officially saying goodbye to .NET Framework 4.8
1 parent d5ae95c commit 7e9d361

3 files changed

Lines changed: 5 additions & 189 deletions

File tree

Src/AjaxHandler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public AjaxHandler(AjaxHandlerOptions options = AjaxHandlerOptions.ReturnExcepti
7272

7373
object result;
7474
if (_options == AjaxHandlerOptions.PropagateExceptions)
75-
result = method.InvokeDirect(api, arr);
75+
result = method.Invoke(api, BindingFlags.DoNotWrapExceptions, null, arr, null);
7676
else
77-
try { result = method.Invoke(api, arr); }
77+
try { result = method.Invoke(api, BindingFlags.DoNotWrapExceptions, null, arr, null); }
7878
catch (Exception e) { throw new AjaxException("Error invoking the AJAX method.", e); }
7979

8080
if (result is JsonValue value)
@@ -98,8 +98,8 @@ public AjaxHandler(AjaxHandlerOptions options = AjaxHandlerOptions.ReturnExcepti
9898
inner[ps[0].Name] = (ps[0].ParameterType, new Func<object, TApi, object>((obj, api) =>
9999
{
100100
if (_options == AjaxHandlerOptions.PropagateExceptions)
101-
return method.InvokeDirect(api, obj);
102-
try { return method.Invoke(api, [obj]); }
101+
return method.Invoke(api, BindingFlags.DoNotWrapExceptions, null, [obj], null);
102+
try { return method.Invoke(api, BindingFlags.DoNotWrapExceptions, null, [obj], null); }
103103
catch (Exception e) { throw new AjaxException("Error invoking an AJAX conversion method.", e); }
104104
}));
105105
}

Src/InvokeDirectExtension.cs

Lines changed: 0 additions & 184 deletions
This file was deleted.

Src/RT.Servers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.1</TargetFrameworks>
55
<Configurations>Debug-Nuget;Debug-locallibs;Release</Configurations>
66
<LangVersion>latest</LangVersion>
77
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>

0 commit comments

Comments
 (0)