Skip to content

Breaking change in BitArray internal structure between .NET 10 preview6 and RC1 #422

@xywf221

Description

@xywf221

Bug Description

In .NET 10 preview6, System.Collections.BitArray had the following internal layout:

public sealed class BitArray : ICollection, ICloneable
{
    private int[] m_array; // Do not rename (binary serialization)
    private int m_length;  // Do not rename (binary serialization)
    private int _version;  // Do not rename (binary serialization)
}

In .NET 10 rc1, it was changed to:

public sealed class BitArray : ICollection, ICloneable, ISerializable
{
    internal byte[] _array;
    private int _bitLength;
    private int _version;
}

This internal breaking change causes incompatibility for MemoryPack when serializing/deserializing BitArray between preview6 and rc1.

internal class BitArrayView
{
	public int[] m_array;

	public int m_length;

	public int _version;
}

If dotnet10 (after preview6) Deserialize the data program serialized by dotnet9, it will crash!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions