diff --git a/src/Prism.Core/Commands/AsyncDelegateCommand.cs b/src/Prism.Core/Commands/AsyncDelegateCommand.cs
index ad4082d160..f424f7b4e7 100644
--- a/src/Prism.Core/Commands/AsyncDelegateCommand.cs
+++ b/src/Prism.Core/Commands/AsyncDelegateCommand.cs
@@ -1,4 +1,4 @@
-using System.Linq.Expressions;
+using System.Linq.Expressions;
using System;
using System.Threading;
using System.Threading.Tasks;
@@ -24,7 +24,11 @@ public class AsyncDelegateCommand : DelegateCommandBase, IAsyncCommand
///
/// The to invoke when is called.
public AsyncDelegateCommand(Func executeMethod)
+#if NET6_0_OR_GREATER
+ : this (c => executeMethod().WaitAsync(c), () => true)
+#else
: this(c => executeMethod(), () => true)
+#endif
{
}
@@ -46,7 +50,11 @@ public AsyncDelegateCommand(Func executeMethod)
/// The to invoke when is called.
/// The delegate to invoke when is called
public AsyncDelegateCommand(Func executeMethod, Func canExecuteMethod)
+#if NET6_0_OR_GREATER
+ : this(c => executeMethod().WaitAsync(c), canExecuteMethod)
+#else
: this(c => executeMethod(), canExecuteMethod)
+#endif
{
}
diff --git a/src/Prism.Core/Commands/AsyncDelegateCommand{T}.cs b/src/Prism.Core/Commands/AsyncDelegateCommand{T}.cs
index ed257ce196..71a74a1c2d 100644
--- a/src/Prism.Core/Commands/AsyncDelegateCommand{T}.cs
+++ b/src/Prism.Core/Commands/AsyncDelegateCommand{T}.cs
@@ -1,4 +1,4 @@
-using System.Linq.Expressions;
+using System.Linq.Expressions;
using System;
using System.Threading;
using System.Threading.Tasks;
@@ -25,7 +25,11 @@ public class AsyncDelegateCommand : DelegateCommandBase, IAsyncCommand
///
/// The to invoke when is called.
public AsyncDelegateCommand(Func executeMethod)
+#if NET6_0_OR_GREATER
+ : this((p,t) => executeMethod(p).WaitAsync(t), _ => true)
+#else
: this((p, t) => executeMethod(p), _ => true)
+#endif
{
}
@@ -47,7 +51,11 @@ public AsyncDelegateCommand(Func executeMethod)
/// The to invoke when is called.
/// The delegate to invoke when is called
public AsyncDelegateCommand(Func executeMethod, Func canExecuteMethod)
+#if NET6_0_OR_GREATER
+ : this((p, c) => executeMethod(p).WaitAsync(c), canExecuteMethod)
+#else
: this((p, c) => executeMethod(p), canExecuteMethod)
+#endif
{
}