-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disallow arrays of System.Void #94835
Conversation
Added When you commit this breaking change:
Tagging @dotnet/compat for awareness of the breaking change. |
/azp run runtime-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
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#88620 Fixes dotnet#94086
@@ -1170,12 +1170,8 @@ mono_class_create_bounded_array (MonoClass *eclass, guint32 rank, gboolean bound | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypedReference is byreflike type, so it is not necessary to check for it explicitly here.
I thought this was always disallowed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !!
Does that work with open generic types or pointers? |
Yes, it does. Pointers are special cased here:
|
The mono changes look ok to me. |
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