System threading tasks extensions


Параметры типа

Результат. The result.


  • Ожидание экземпляра несколько раз. Awaiting the instance multiple times.
  • Вызов AsTask несколько раз. Calling AsTask multiple times.
  • Использование .Result или .GetAwaiter().GetResult() , если операция еще не завершена, или их использование несколько раз. Using .Result or .GetAwaiter().GetResult() when the operation hasn’t yet completed, or using them multiple times.
  • Использование более чем одного из этих методов для использования экземпляра. Using more than one of these techniques to consume the instance.

Если вы выполните одно из указанных выше действий, результаты не будут определены. If you do any of the above, the results are undefined.

Таким образом, по умолчанию любой асинхронный метод должен возвращать Task или Task . As such, the default choice for any asynchronous method should be to return a Task or Task . Только если анализ производительности доказывает, что необходимо использовать ValueTask вместо Task . Only if performance analysis proves it worthwhile should a ValueTask be used instead of a Task . Неуниверсальная версия ValueTask не рекомендуется для большинства сценариев. The non generic version of ValueTask is not recommended for most scenarios. Свойство CompletedTask следует использовать для обратного успешного завершения одноэлементного элемента в случае, когда метод, возвращающий Task, завершается синхронно и успешно. The CompletedTask property should be used to hand back a successfully completed singleton in the case where a method returning a Task completes synchronously and successfully.



Возвращает значение, указывающее, представляет ли этот объект отмененную операцию. Gets a value that indicates whether this object represents a canceled operation.

Возвращает значение, указывающее, представляет ли этот объект завершенную операцию. Gets a value that indicates whether this object represents a completed operation.

Читайте также:  D link dir 130

Возвращает значение, указывающее, представляет ли этот объект успешно завершенную операцию. Gets a value that indicates whether this object represents a successfully completed operation.

Возвращает значение, указывающее, представляет ли этот объект операцию, завершившуюся ошибкой. Gets a value that indicates whether this object represents a failed operation.

Возвращает результат. Gets the result.


Настраивает объект типа awaiter для этого значения. Configures an awaiter for this value.

Создает построитель метода для использования с асинхронным методом. Creates a method builder for use with an async method.

Определяет, равен ли указанный объект текущему объекту. Determines whether the specified object is equal to the current object.

Создает объект типа awaiter для этого значения. Creates an awaiter for this value.

Возвращает хэш-код для данного экземпляра. Returns the hash code for this instance.

Возвращает строку, представляющую текущий объект. Returns a string that represents the current object.


Сравнивает два значения на предмет их равенства. Compares two values for equality.

Please help how to solve this?

‘Npgsql’ already has a dependency defined for ‘System.Threading.Tasks.Extensions’:

I’ve already installed package System.Threading.Tasks.Extensions -Version 4.4.0 Install-Package System.Threading.Tasks.Extensions -Version 4.4.0

even after that I am unable to overcome this issue.

1 Answer 1

You can refresh the nupkg dll by downloading and copying it manually.

  • Go to:
  • Click: Manual download option.
  • Open the nupkg downloaded file with a file extraction program like WinZip or WinRar.
  • Search for the dll in the path lib
    et45Npgsql.dll and copy.

Not the answer you’re looking for? Browse other questions tagged npgsql or ask your own question.



Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Читайте также:  C отловить нажатие клавиш

site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2020.1.17.35809


Copy link Quote reply

godrose commented Sep 7, 2018 •

The version 4.9.0 depends on specific version 4.3.0 of System.Threading.Tasks.Extensions package.
This introduces conflicts with other external packages that use later versions of this package (like System.Reactive )

This comment has been minimized.

Copy link Quote reply

stakx commented Sep 7, 2018 •

Hi @godrose. Moq is currently intentionally specifying an older version of the STTE NuGet package because of the awful binding redirect problems the latest version of the day caused; see #566 (comment).

But Moq doesn’t pin that exact version. You should still be able to install a later version of STTE in your project. This might take some fiddling with NuGet settings.

While Moq is targeting net45 and netstandard13 , I am not going to change that particular dependency. (Later edit: Let’s not be irrational about it and see if things have improved by now.) Sorry if this seems irrational, I’ve been burnt rather badly #566 and don’t want to run any risk of putting everyone back in that situation.

That being said, NuGet tooling has likely improved in the meantime. Once we update the targeted platform(s) for Moq (see e.g. #630), I’ll reevaluate & update all System package dependencies. That’s likely going to happen for Moq 4.11.0.

This comment has been minimized.

Copy link Quote reply

godrose commented Sep 11, 2018

@stakx Thanks for the reply.
I was able to install the latest version. That’s how I got the conflict. Redirect didn’t help.
I guess I’ll wait until 4.11.0 then.

Читайте также:  Espiritu de chile carmenere

This comment has been minimized.

Copy link Quote reply

stakx commented Sep 11, 2018

@godrose — If you are using a recent version of Visual Studio and MSBuild, there should in theory be no need to manually configure binding redirects, unless perhaps you created your project file with previous tooling versions. Find a few things below that you can try.

Using a recent VS version, things should be as simple as this: Create a new console app project (I’ve tried with both .NET 4.6.1 and .NET Core 2.0). Then install Moq 4.10.0. Then install STTE 4.5.1. The NuGet package manager will tell you that that it’s going to upgrade STTE from version 4.3.0 to 4.5.1. Code & run.

Make sure that the project which references Moq, or the executable project "above" it, references the desires version of the STTE package to enforce that package version.

If you are targeting .NET Core, you shouldn’t have to do anything esle since .NET Core isn’t as strict when it comes to assembly versioning as the .NET Framework.

If you are targeting the .NET Framework however, and you’re using the new SDK-style .csproj format, any required binding redirects should be automatically generated for you in the bin output folder’s .config file (not in the one in your project root!).

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *