Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 11, 2025

Plan to add unit test for issue #7346 (custom attribute constructor crash on null array of enums):

  • Understand the issue: Issue Additional BotR Chapters #7346 was about a crash when a custom attribute constructor has a null array of enums
  • Baseline setup: Build clr+libs successfully
  • Configure PATH and verify SDK version
  • Add a custom attribute class that accepts null enum array in constructor
  • Add test method to verify the attribute can be retrieved without crashing
  • Build the System.Runtime tests
  • Run the tests to verify they pass - all CustomAttributeDataTests pass (8 tests)
  • Apply code review suggestions - improved test coverage with multiple array scenarios
  • Fix build break by adding using statement for ReadOnlyCollection
  • Commit the changes
Original prompt

This section details on the original issue you should resolve

<issue_title>Add unit test for issue #7346 (custom attribute constructor crash on null array of enums)</issue_title>
<issue_description>Just need to wait for the fix in coreclr to propagate over to corefx.

https://github.com/dotnet/coreclr/issues/7346
</issue_description>

Comments on the Issue (you are @copilot in this section)

@karelz @atsushikan I unassigned it from you to reflect 'up for grabs'. If/when you work on it, please assign it to yourself. Thanks!

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.

@Copilot 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
@Copilot Copilot AI requested a review from stephentoub October 11, 2025 18:51
Copilot finished work on behalf of stephentoub October 11, 2025 18:51
@stephentoub stephentoub marked this pull request as ready for review October 11, 2025 19:36
@Copilot Copilot AI review requested due to automatic review settings October 11, 2025 19:36
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (MyTestEnum and MyEnumArrayAttribute) for the test
  • Validates that the fix prevents crashes and correctly handles null array values in custom attribute reflection

@stephentoub stephentoub added area-System.Reflection test-enhancement Improvements of test source code labels Oct 11, 2025
@stephentoub stephentoub enabled auto-merge (squash) October 11, 2025 19:45
auto-merge was automatically disabled October 12, 2025 00:51

Head branch was pushed to by a user without write access

@Copilot Copilot AI requested a review from jkotas October 12, 2025 00:52
Copilot finished work on behalf of jkotas October 12, 2025 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Reflection test-enhancement Improvements of test source code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit test for issue #7346 (custom attribute constructor crash on null array of enums)

3 participants