Fix bug when multiple Span-params share a CountParamIndex and one param is null #1575
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.
When we have multiple buffer params that all have their size described by one count parameter, the implementation is ending up with the last one passed in as the length. It also asserts that all buffers have the same length.
This assert is wrong and should only fire if both buffers are non-empty and have different length. Also this logic error highlights the problem that the length we choose to pass to native is also wrong when you pass some shared params as null and others as non-null. So I also updated the generated code to build up an expression for the length based on all the spans like
(span1.IsEmpty ? span2.Length : span1.Length).Fixes #1560