ValveSoftware / ValveSoftware/Proton

Terraria (105600)

Open
#3,341 32 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

.NET .NET-XNA Game compatibility - Unofficial
Dominant language
C++
Stars
32.8k
Forks
1.6k
PR merge metrics
PR metrics pending

Description

Compatibility Report

  • Name of the game with compatibility issues: Terraria
  • Steam AppID of the game: 105600

System Information

  • GPU: GTX 770
  • Driver/LLVM version: NVIDIA 440.36
  • Kernel version: 5.3.13-200.fc30
  • Link to full system information report as Gist
  • Proton version: 4.11-11

I confirm:

  • that I haven't found an existing compatibility report for this game.
  • that I have checked whether there are updates for my system available.

Symptoms

The issue can be summed up in one Exception:

System.ArgumentException: Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: 'System.Comparison``1[System.Int32]'.
  at System.Collections.Generic.IntrospectiveSortUtilities.ThrowOrIgnoreBadComparer (System.Object comparer) [0x0000b] in <d3b61d05e0d14bda9e0d978e561956eb>:0 
  at System.Collections.Generic.ArraySortHelper``1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison``1[T] comparer) [0x0000f] in <d3b61d05e0d14bda9e0d978e561956eb>:0 
  at System.Collections.Generic.List``1[T].Sort (System.Comparison``1[T] comparison) [0x00018] in <d3b61d05e0d14bda9e0d978e561956eb>:0 
  at Terraria.UI.ItemSorting+ItemSortingLayers+<>c.<.cctor>b__40_108 (Terraria.UI.ItemSorting+ItemSortingLayer layer, Terraria.Item[] inv, System.Collections.Generic.List``1[T] itemsToSort) [0x00065] in <656615216c7c4289b27347cde9255acc>:0 
  at Terraria.UI.ItemSorting.SetupWhiteLists () [0x0021b] in <656615216c7c4289b27347cde9255acc>:0 
  at Terraria.Main.ClientInitialize () [0x001aa] in <656615216c7c4289b27347cde9255acc>:0 
  at Terraria.Main.Initialize () [0x0640a] in <656615216c7c4289b27347cde9255acc>:0 
  at Microsoft.Xna.Framework.Game.DoInitialize () [0x0000d] in <7ff45bf12adb4fa788baf2c3b3fc2840>:0 
  at Microsoft.Xna.Framework.Game.Run () [0x0000e] in <7ff45bf12adb4fa788baf2c3b3fc2840>:0 
  at Terraria.Program.LaunchGame (System.String[] args, System.Boolean monoArgs) [0x00092] in <656615216c7c4289b27347cde9255acc>:0

The latest Mono BCL breaks compatibility with older .NET versions, in the form of a more aggressive IComparer behavior. thfr found this when doing *BSD ports of various FNA games:

https://github.com/rfht/fnaify/issues/16

There's a patch in place for OpenBSD, and it's simple enough...

https://github.com/openbsd/ports/commit/7670058636c4985f47fa8da6dceaa9e7fec4f933

... but for accuracy this should only apply to games running against .NET 4.0 and older. Finding a way to determine this at runtime would be a more appropriate fix, and Mono upstream would be more likely to accept it.

Reproduction

  1. Start Terraria
  2. Read the Exception pop-up
  3. Exit!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Terraria.UI.ItemSorting.SetupWhiteLists and Terraria.Main.ClientInitialize frames in the reported exception, then compare the linked OpenBSD ports patch and investigate Mono behavior for .NET 4.0 and older. Done means Terraria starts without the inconsistent-comparer exception while newer runtime behavior remains unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, linux
Domain
operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.