Skip to content

Strings pulled from Console.ReadLine() don't work as Dictionary Keys if the string lengh is odd numbered #2338

@Incoherent-Code

Description

@Incoherent-Code

I have no idea what causes this or if its even cosmos' fault but if an input from Console.ReadLine() is odd numbered it is not recognized in a Dictionary with with the string as a key.
This issue also happens when decoding strings from a filesystem and trying to use them as a key.
This does not happen if the string is made in the code like if you do: dictionaryEx.Contains("a");

Area of Cosmos - What area of Cosmos are we dealing with?

System.Collections.Generic.Dictionary<>

Expected Behaviour - What do you think that should happen?

image
All of these inputs are in my Dictionary but only the ones with even amounts of characters work.
Expected behavior would have all of these inputs return true.

Reproduction - How did you get this error to appear?

You can either make your system take console inputs and try to use them in a dictionary that uses string as keys with different lengths,
or you can try this test kernel that I used in the screenshot:
https://pastebin.com/DJnbqaac

Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?

Latest Dev kit Commit (Updated my installation 4 days ago)

Metadata

Metadata

Assignees

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