fixed invalid generics for task service method
(cherry picked from commit ffc66253310875393bf14412a9dd218df95cff6c)