Add fully qualifying Task namespace for retrun statements

This commit is contained in:
Portikus 2018-05-08 10:28:58 +02:00
Родитель cf0cf9c8ad
Коммит ecbae476f7
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -57,12 +57,12 @@ namespace Etg.SimpleStubs.CodeGen.Utils
{ {
var namedReturnType = (INamedTypeSymbol) returnType; var namedReturnType = (INamedTypeSymbol) returnType;
var genericReturnType = namedReturnType.TypeArguments.First(); var genericReturnType = namedReturnType.TypeArguments.First();
return $"return Task.FromResult(default({genericReturnType.GetFullyQualifiedName()}));{System.Environment.NewLine}"; return $"return System.Threading.Tasks.Task.FromResult(default({genericReturnType.GetFullyQualifiedName()}));{System.Environment.NewLine}";
} }
else if (returnType.MetadataName.Equals(taskType.MetadataName)) else if (returnType.MetadataName.Equals(taskType.MetadataName))
{ {
// do not use Task.CompletedTask to stay compatible with .Net 4.5 // do not use Task.CompletedTask to stay compatible with .Net 4.5
return $"return Task.FromResult(true);{System.Environment.NewLine}"; return $"return System.Threading.Tasks.Task.FromResult(true);{System.Environment.NewLine}";
} }
else if (asyncActionType != null && returnType.MetadataName.Equals(asyncActionType.MetadataName)) else if (asyncActionType != null && returnType.MetadataName.Equals(asyncActionType.MetadataName))
{ {