Skip to content
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

[Breaking change]: Disallow creating a type of array of System.Void #38311

Closed
1 of 3 tasks
jkotas opened this issue Nov 18, 2023 · 0 comments · Fixed by #39198
Closed
1 of 3 tasks

[Breaking change]: Disallow creating a type of array of System.Void #38311

jkotas opened this issue Nov 18, 2023 · 0 comments · Fixed by #39198
Assignees
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 9 Work items for the .NET 9 release doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 📌 seQUESTered Identifies that an issue has been imported into Quest.

Comments

@jkotas
Copy link
Member

jkotas commented Nov 18, 2023

Description

Creating System.Type instance for array of System.Void is no longer allowed.

Version

.NET 9 Preview 1

Previous behavior

typeof(void).MakeArrayType() returned System.Type instance.

New behavior

typeof(void).MakeArrayType() throws an exception.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
  • Behavioral change: Existing binaries may behave differently at run time.

Reason for change

Array of System.Void is an invalid type. This type is rejected in number of situations (e.g. void[] in C# does not compile) and it is not possible to create arrays of this type.

.NET runtimes allowed this invalid type to be created in some situations. However, attempts to use this invalid type lead in other .NET runtime APIs often lead to unexpected behaviors. It is better to disallow creating these invalid array types in all situations to make the behavior robust and consistent.

Recommended action

Remove code that tries to create a type for array of System.Void.

Feature area

Core .NET libraries

Affected APIs

System.Type.MakeArrayType


Associated WorkItem - 196554

@jkotas jkotas added doc-idea Indicates issues that are suggestions for new topics [org][type][category] breaking-change Indicates a .NET Core breaking change Pri1 High priority, do before Pri2 and Pri3 labels Nov 18, 2023
@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label Nov 18, 2023
@gewarren gewarren removed the ⌚ Not Triaged Not triaged label Nov 18, 2023
@gewarren gewarren added the 🗺️ reQUEST Triggers an issue to be imported into Quest. label Jan 2, 2024
@github-actions github-actions bot added 📌 seQUESTered Identifies that an issue has been imported into Quest. and removed 🗺️ reQUEST Triggers an issue to be imported into Quest. labels Jan 3, 2024
@gewarren gewarren added the 🏁 Release: .NET 9 Work items for the .NET 9 release label Jan 12, 2024
@gewarren gewarren moved this from 🔖 Ready to 👀 In review in dotnet/docs January 2024 sprint Jan 18, 2024
@ghost ghost added the in-pr This issue will be closed (fixed) by an active pull request. label Jan 18, 2024
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in dotnet/docs January 2024 sprint Jan 19, 2024
@ghost ghost removed the in-pr This issue will be closed (fixed) by an active pull request. label Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 9 Work items for the .NET 9 release doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 📌 seQUESTered Identifies that an issue has been imported into Quest.
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants