Skip to content

Won't compile without error .NET8 - This call is ambiguous... #15

@jeff922

Description

@jeff922

After cloning repo, upgrading to .NET8 release, and building the following error occurs in:

\open-dis-csharp\CsharpDis6\OpenDis\Enumerations\Entity.Information.Minefield\PaintScheme.cs
line 275 public byte[] ToByteArray() => BitConverter.GetBytes(ToByte());

CS0121 The call is ambiguous between the following methods or properties: 'BitConverter.GetBytes(Half)' and 'BitConverter.GetBytes(short)'

This may have been introduced in .NET 7 per the post below:
dotnet/runtime#79034

Recommend changing line to the following to support .NET 8 and past versions
public byte[] ToByteArray() => BitConverter.GetBytes((short)ToByte());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions