Add support for by-ref-like (ref struct) parameter types such as Span<T> and ReadOnlySpan<T> #712
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.
Unlike my earlier draft #664, this PR will not require DynamicProxy user code to set up any value converters for byref-like parameters. Instead, any byref-like argument will automatically get wrapped in one of the new types
ByRefLikeArgument,ByRefLikeArgument<TByRefLike>(only available on .NET 9+),SpanArgument<T>, orReadOnlySpanArgument<T>. The original byref argument value can be retrieved from those wrappers using theirGetorGetPointermethods. The latter retrieval method hints at this new feature involving some unmanaged pointer trickery under the hood... but it can probably be made reasonably safe to use. (I'll make sure to write a documentation page for this new feature so that there's some guidance.)I'm not done yet, so marking this PR as a draft. I'll add a more complete description for the new API as I make further progress.
Will close #663 once completed and merged.