Skip to content

Conversation

@xtqqczze
Copy link
Contributor

@xtqqczze xtqqczze commented Sep 9, 2025

This change removes the SR.Argument_NeedStructWithNoRefs resource string and updates the corresponding ArgumentException message to be more descriptive.

The old message was:

The specified Type must be a struct containing no references.

This has been replaced with:

The type '{0}' is not supported because it contains references.

This change removes the `SR.Argument_NeedStructWithNoRefs` resource string and updates the corresponding `ArgumentException` message to be more descriptive.

The old message was:

```
The specified Type must be a struct containing no references.
```

This has been replaced with:

```
Cannot use type '{0}'. Only value types without pointers or references are supported.
```
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 9, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Sep 9, 2025
@xtqqczze
Copy link
Contributor Author

xtqqczze commented Sep 9, 2025

The exception message could even be simplified to: Type '{0}' must be a value type without references.

@jkotas
Copy link
Member

jkotas commented Sep 9, 2025

The exception message could even be simplified to: Type '{0}' must be a value type without references.

Yes, the existing message is misleading. Value types with (unmanaged) pointers are supported by these APIs.

Also, the ThrowHelper name should be updated to match.

Could you please make these fixes?

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thanks

@jkotas jkotas merged commit 08fd865 into dotnet:main Sep 10, 2025
145 checks passed
@xtqqczze xtqqczze deleted the Argument_NeedStructWithNoRefs branch September 10, 2025 02:26
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community-contribution Indicates that the PR has been added by a community member needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants