MultipartFormDataBinaryContent has a static Random instance that's being used without a lock. This locks around each access (an alternative would be to use and lazily-initialize on each access a [ThreadStatic] Random).
While fixing that, also improved a few things:
We don't need to create a char[] for the boundary values; the const string can be used directly.
For netstandard2.0, we don't need to allocate a char[]; a stackalloc'd span can be used directly.
For .NET, we don't need a stackalloc, either; we can use string.Create and write directly into the new string instance.
For .NET, we don't need a dedicated Random instance, either; we can use Random.Shared.
For .NET, Random allows writing into a byte span, so we don't need the byte[] allocation either and can stackalloc it.
For .NET, just %'ing by the string length produces as good or better code than using a manually-computed mask.
MultipartFormDataBinaryContent has a static Random instance that's being used without a lock. This locks around each access (an alternative would be to use and lazily-initialize on each access a [ThreadStatic] Random).
While fixing that, also improved a few things: