Skip to content

Overloads with string parameters should be included in .NET 6.0 build to maintain binary backwards compatibility with .NET Standard 2.0 #436

@NoahStolk

Description

@NoahStolk

From this comment: #412 (comment)

Since overloads for ReadOnlySpan<char> have been added, methods using string are no longer included in the .NET 6.0 build, which causes runtime errors in binaries where both versions are used through different projects.

How to reproduce:

  • Create 2 projects; one .NET Standard 2.0 and one .NET 6 or 7. Reference ImGui.NET in both projects, either through ProjectReference or PackageReference.
  • Call an ImGui method with a string parameter from the .NET Standard 2.0 library.
  • Call the library from the other project. It will crash because the .NET Standard 2.1 version of ImGui.NET has been compiled and included in the binary, while the .NET Standard 2.0 library expects the methods present in the .NET Standard 2.0 version.

To fix this we'd need to include string overloads again. However, this results in the string overloads taking precedence over ReadOnlySpan<char> which means you'd have to write ImGui.Text("Hello, world!".AsSpan()); instead of ImGui.Text("Hello, world!"); (I think).

Related issue: zaafar/ClickableTransparentOverlay#48

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