I can't compile the following code with latest version VS 2017 build 15.5.0.
void MyMethod(object[] objects)
{
TypedReference.SetTypedReference((TypedReference)objects[0], objects[1]);
}
_This issue has been moved from https://developercommunity.visualstudio.com/content/problem/166353/error-cs0030-cannot-convert-type-object-to-systemt.html
VSTS ticketId: 537144_
_These are the original issue comments:_
(no comments)
_These are the original issue solutions:_
(no solutions)
Tagging @VSadov to triage and advise. Thanks
When will this bug be resolved?
This is not a bug. A TypedReference cannot be boxed, so there is no conversion between object and TypedReference in either direction. That is why you cannot cast objects[0] to the type TypedReference.
I don't have problem with older compiler version.
@bprg Old compiler has bugs in this area. It may permit code that would not run or even be accepted by the JIT.
Most helpful comment
Tagging @VSadov to triage and advise. Thanks