Compiled Buffer bracket reads try to convert method names into integers

Open
#3,893 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp, typescript
Domain
backend, compilers

Research direction

Start at the compiled Buffer branch of $Runtime.GetIndex and trace how it handles string keys versus numeric byte indexes. Compare the compiled behavior with ordinary property access and the interpreter behavior shown in the example. Done means b['includes'] resolves to a function in compiled execution while numeric indexing still works; the issue names no test file, so locate or add coverage for both cases.

Written by the indexing model from the issue text.

Description

Found while verifying #3885. The compiled Buffer branch of $Runtime.GetIndex always converts its key to an integer, including names that work through ordinary property access.

function inspect(b) { console.log(typeof b['includes']); }
inspect(Buffer.of(65));

Node.js v22.23.2 and SharpTS interpretation print function. Compiled execution throws a CLR System.FormatException for the string includes. Named keys should use the same property lookup as dot access, alongside numeric byte indexing.

Dominant language
C#
Stars
156
Forks
4
Avg merge
13h 20m
Merged PRs (30d)
47

Getting set up

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.

More from nickna/SharpTS

All issues in nickna/SharpTS

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.