You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using BitArray.CopyTo() in .NET Core 3 it seems the bits are always copied to the last position of the provided array.
General
My setup is a .NetStandard 2 class library with a method that contains a BitArray.CopyTo(Array, int). If I use this library from within a WPF application using .Net 4.7.2 everything works as expected. When I use the exact same library from within a .NET Core 3 application (Console or WPF) always the last byte of the array is overwritten and the index parameter is ignored. Example:
In .NET 4.7.2 and earlier this would result in an array 0F-08. In .NET Core 3 it results in an array 00-08 as the second CopyTo overwrites the 0F that was wrongly copied to index 1 instead of index 0. If you increase the byteHolder length to eg. 5. It would result in 0F-08-00-00-00 in 4.7.2 and 00-00-00-00-08 in Core 3.
Best regards
Michael
The text was updated successfully, but these errors were encountered:
Hello @MichaelL79 , thanks for reporting this.
Since this is a potential issue in our libraries, I will transfer it to the dotnet/corefx repo for higher visibility.
BitArray.CopyTo(Array, int) seems broken
When using BitArray.CopyTo() in .NET Core 3 it seems the bits are always copied to the last position of the provided array.
General
My setup is a .NetStandard 2 class library with a method that contains a BitArray.CopyTo(Array, int). If I use this library from within a WPF application using .Net 4.7.2 everything works as expected. When I use the exact same library from within a .NET Core 3 application (Console or WPF) always the last byte of the array is overwritten and the index parameter is ignored. Example:
In .NET 4.7.2 and earlier this would result in an array 0F-08. In .NET Core 3 it results in an array 00-08 as the second CopyTo overwrites the 0F that was wrongly copied to index 1 instead of index 0. If you increase the byteHolder length to eg. 5. It would result in 0F-08-00-00-00 in 4.7.2 and 00-00-00-00-08 in Core 3.
Best regards
Michael
The text was updated successfully, but these errors were encountered: