Uh oh!
There was an error while loading. Please reload this page.
Disallow arrays of System.Void - #94835
Conversation
ghost
commented
Nov 16, 2023
Added When you commit this breaking change:
Tagging @dotnet/compat for awareness of the breaking change. |
jkotas
commented
Nov 16, 2023
/azp run runtime-coreclr outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Uh oh!
There was an error while loading. Please reload this page.
The CoreCLR type loader allowed creating arrays of System.Void. Many operations with these invalid array types failed, often in inscrutable ways. For example, GetInterfaces() call failed with type load exception of IEnumerable type. The exact failure modes are different between runtimes. It is better to disallow creating these invalid array types in the first place, across all runtimes, to make the behavior robust and consistent. Related to dotnet#88620Fixesdotnet#94086
| klass->rank = GUINT32_TO_UINT8 (rank); | ||
| klass->element_class = eclass; | ||
| if (m_class_get_byval_arg (eclass)->type == MONO_TYPE_TYPEDBYREF) { |
There was a problem hiding this comment.
TypedReference is byreflike type, so it is not necessary to check for it explicitly here.
VSadov
commented
Nov 17, 2023
I thought this was always disallowed. |
VSadov
commented
Nov 17, 2023
Does that work with open generic types or pointers? |
jkotas
commented
Nov 17, 2023
Yes, it does. Pointers are special cased here: |
vargaz
commented
Nov 17, 2023
The mono changes look ok to me. |
jkotas
commented
Nov 18, 2023
Breaking change issue dotnet/docs#38311 |
The CoreCLR type loader allowed creating arrays of
System.Void. Many operations with these invalid array types failed, often in inscrutable ways. For example,GetInterfaces()call failed with type load exception ofIEnumerable<void>type. The exact failure modes are different between runtimes.It is better to disallow creating these invalid array types in the first place, across all runtimes, to make the behavior robust and consistent.
Related to #88620
Fixes#94086