Objo.
Feedback Forum Docs Objo Studio
Feedback

Bug #1616

Task(Of T).Result is typed as Object instead of T

Status
Fixed
Fixed in
v26.10.1
Area
compiler
Source discussion
https://forum.objo.dev/d/1216-taskof-tresult-is-typed-as-object
Last updated
2026-10-05

Upvotes

0 upvotes

Uses your Objo forum account.

Public summary

Accessing Result on a Task(Of T) value fails to compile when the result is assigned to a variable of type T. The compiler types task.Result as Object instead of T, even though Result is documented as type T for Task(Of T).

For example, this documented pattern is rejected:

Var t1 As Task(Of DBAnswer) = QueryAsync()
Var a As DBAnswer = t1.Result   ' error: Cannot assign 'Object' to variable of type 'DBAnswer'

Await t1 and an explicit cast (DBAnswer(t1.Result)) both work, so the value is correct at runtime; only the compile-time type of the Result expression is wrong. Users following the published Task documentation or combining Task.WhenAll with per-task Result reads hit a spurious compile error and must add unnecessary casts.

Objo.

Build apps visually, deploy anywhere.

Feedback is a public read-only status mirror for Objo Studio.