Returning ``++Nothing++`` from a non-``++async++`` ``++Task++``/``++Task(Of T)++`` method will cause a ``++NullReferenceException++`` at runtime. This problem can be avoided by returning ``++Task.FromResult(Of T)(Nothing)++`` instead.

== Noncompliant Code Example

[source,vbnet]
----
Public Function GetFooAsync() As Task(Of Object)
    Return Nothing
End Function
----

== Compliant Solution

[source,vbnet]
----
Public Function GetFooAsync() As Task(Of Object)
    Return Task.FromResult(Of Object)(Nothing)
End Function
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

include::../highlighting.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
