diff --git a/IPA.Loader/Loader/PluginManager.cs b/IPA.Loader/Loader/PluginManager.cs index 98dc9afc..ae5f8fd3 100644 --- a/IPA.Loader/Loader/PluginManager.cs +++ b/IPA.Loader/Loader/PluginManager.cs @@ -15,6 +15,7 @@ using Logger = IPA.Logging.Logger; using System.Threading.Tasks; #if NET4 using TaskEx = System.Threading.Tasks.Task; +using TaskEx6 = System.Threading.Tasks.Task; using Task = System.Threading.Tasks.Task; #endif #if NET3 @@ -177,7 +178,7 @@ namespace IPA.Loader else { if (exec.Executor.Metadata.RuntimeOptions != RuntimeOptions.DynamicInit) - return TaskEx.FromException(new CannotRuntimeDisableException(exec.Executor.Metadata)); + return TaskEx6.FromException(new CannotRuntimeDisableException(exec.Executor.Metadata)); var res = TaskEx.WhenAll(exec.Dependents.Select(d => Disable(d, alreadyDisabled))) .ContinueWith(t => TaskEx.WhenAll(t, exec.Executor.Disable())).Unwrap(); diff --git a/Net3-Proxy/Net3-Proxy.csproj b/Net3-Proxy/Net3-Proxy.csproj index 67f6e4c5..21a7bccd 100644 --- a/Net3-Proxy/Net3-Proxy.csproj +++ b/Net3-Proxy/Net3-Proxy.csproj @@ -48,6 +48,7 @@ + diff --git a/Net3-Proxy/TaskEx6.cs b/Net3-Proxy/TaskEx6.cs new file mode 100644 index 00000000..8ad0ec39 --- /dev/null +++ b/Net3-Proxy/TaskEx6.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Net3_Proxy +{ + public static class TaskEx6 + { + public static Task FromException(Exception exception) + { + if (exception == null) throw new ArgumentNullException(nameof(exception)); + var tcs = new TaskCompletionSource(); + tcs.TrySetException(exception); + return tcs.Task; + } + public static Task FromException(Exception exception) => FromException(exception); + + private struct VoidTaskResult { } + } +}