Add unit test for issue #7346 (custom attribute constructor crash on null array of enums)#120641
Merged
Add unit test for issue #7346 (custom attribute constructor crash on null array of enums)#120641
Conversation
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add unit test for custom attribute constructor crash
Add unit test for issue #7346 (custom attribute constructor crash on null array of enums)
Oct 11, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a unit test to verify that a crash issue with custom attribute constructors receiving null arrays of enums has been fixed. The issue (dotnet/coreclr#7346) caused crashes when custom attributes with null enum array parameters were processed through reflection.
- Adds a test case that applies a custom attribute with a null enum array parameter and verifies it can be retrieved safely
- Introduces supporting types (
MyTestEnumandMyEnumArrayAttribute) for the test - Validates that the fix prevents crashes and correctly handles null array values in custom attribute reflection
stephentoub
approved these changes
Oct 11, 2025
jkotas
approved these changes
Oct 11, 2025
...ries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/CustomAttributeDataTests.cs
Show resolved
Hide resolved
...ries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/CustomAttributeDataTests.cs
Outdated
Show resolved
Hide resolved
...ries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/CustomAttributeDataTests.cs
Show resolved
Hide resolved
jkotas
reviewed
Oct 12, 2025
...ries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/CustomAttributeDataTests.cs
Show resolved
Hide resolved
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
auto-merge was automatically disabled
October 12, 2025 00:51
Head branch was pushed to by a user without write access
jkotas
reviewed
Oct 12, 2025
...ries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/CustomAttributeDataTests.cs
Show resolved
Hide resolved
…/Reflection/CustomAttributeDataTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan to add unit test for issue #7346 (custom attribute constructor crash on null array of enums):
Original prompt
Fixes #18847
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.