waf / CSharpRepl

A command line C# REPL with syntax highlighting – explore the language, libraries and nuget packages interactively.
https://fuqua.io/CSharpRepl/
Mozilla Public License 2.0
2.83k stars 106 forks source link

Bugged Memory<T> output #317

Closed Emik03 closed 5 months ago

Emik03 commented 10 months ago

Version

0.6.5

What happened?

A non-default Memory<T> doesn't produce the correct output on detailed mode.

Expected

Displays .ToString() properly, such as...

> "foobar".AsMemory()[3..]
"bar"
└── 🟡 Length: 3

Actual

> "foobar".AsMemory()[3..]
!<Member 'ToString(),raw' not found>
├── 🟡 IsFixedSize: true
├── 🟡 IsReadOnly: false
├── 🟡 IsSynchronized: false
├── 🟡 Length: 3
├── 🟡 LongLength: 3
├── 🟡 Rank: 1
└── 🟡 SyncRoot: char[3]
    ┌──────┬───────┬──────┐
    │ Name │ Value │ Type │
    ├──────┼───────┼──────┤
    │ [0]  │ 'b'   │ char │
    │ [1]  │ 'a'   │ char │
    │ [2]  │ 'r'   │ char │
    └──────┴───────┴──────┘

> 

Workaround

Adding a .ToString() or .ToArray() solves this issue.

> "foobar".AsMemory()[3..].ToString()
bar
└── 🟡 Length: 3