Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change MemoryTestSequenceFactory to test this scenario as well
  • Loading branch information
adamsitnik committed Aug 16, 2021
commit aff7e307c69d44162e82a86c41b16ed732709a2f
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ internal class MemoryTestSequenceFactory : ReadOnlySequenceFactory<T>
{
public override ReadOnlySequence<T> CreateOfSize(int size)
{
return CreateWithContent(new T[size]);
#if DEBUG
return new ReadOnlySequence<T>(new ReadOnlyMemory<T>(new T[size + 1]).Slice(1)); // #57472
#else
return new ReadOnlySequence<T>(new ReadOnlyMemory<T>(new T[size]));
#endif
Copy link
Member

Choose a reason for hiding this comment

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

I generally prefer for the ifdef to be around the minimal thing that's different, so that it's clear what exactly the difference is. e.g.

ReadOnlyMemory<T> m = new T[size + 1];
#if DEBUG
m = m.Slice(1);
#endif
return new ReadOnlySequence<T>(m);

}

public override ReadOnlySequence<T> CreateWithContent(T[] data)
Expand Down