microsoft / microsoft/Power-Fx

Text function: some single character text formats result in an error

Open
#2,291 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.4k
Forks
358
Avg merge
10h 34m
Merged PRs (30d)
3

Description

Some single character format strings result in an error from the C# format routine. A character on either side seems to be fine. This behavior doesn't appear to be documented in https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings. We should escape single characters in the C# interpreter.

>> Text( 12, "i" )
Format specifier was invalid.

>> Text( 12, "i " )
"i "

>> Text( 12, " i" )
" i"

>> Text( 12, "j" )
Format specifier was invalid.

>> Text( 12, "k" )
Format specifier was invalid.

>> Text( 12, "l" )
Format specifier was invalid.

>> Text( 12, "z" )
"z"

>> Text( 12, "x" )
"x"

>> Text( 12, "\i" )
"i"

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 C# interpreter's Text function and trace how its format string is passed to the C# format routine. Reproduce the examples in the issue, then confirm that single-character formats such as "i", "j", "k", and "l" no longer error while existing multi-character and escaped formats retain their behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.