Skip to content

Current dotnet.config implementation violates TOML spec #48009

@Youssef1313

Description

@Youssef1313

I was trying to parse the current way of dotnet.config in TS:

[dotnet.test:runner]
name= "Microsoft.Testing.Platform"

And it failed to parse:

import * as toml from 'toml';

var dotnetConfig = "[dotnet.test:runner]\n" +
    "name= \"Microsoft.Testing.Platform\"";

var result = toml.parse(dotnetConfig);
console.log("Hello");
node_modules\toml\lib\parser.js:3833
      throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
      ^
[SyntaxError: Expected ".", "]", [ \t] or [A-Za-z0-9_\-] but ":" found.] {
  expected: [
    { type: 'literal', value: '.', description: '"."' },
    { type: 'literal', value: ']', description: '"]"' },
    { type: 'class', value: '[ \\t]', description: '[ \\t]' },
    {
      type: 'class',
      value: '[A-Za-z0-9_\\-]',
      description: '[A-Za-z0-9_\\-]'
    }
  ],
  found: ':',
  offset: 12,
  line: 1,
  column: 13
}

The error from TS TOML parser looks correct. The spec doesn't allow : in a key (in the case above, we use it in table key)

https://toml.io/en/v1.0.0#keys

ALSO: https://toml.io/en/v1.0.0#filename-extension

TOML files should use the extension .toml.

I'd try to be very careful violating this as naming the file dotnet.config if we really want to use TOML.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions