dotnet muxer reports JSON syntax error when global.json is saved in UTF8+BOM
See original GitHub issueSteps to reproduce
- Save global.json in utf8 with byte order mark.
- dotnet build
Expected behavior
dotnet build shows no errors
Actual behavior
A JSON parsing exception occurred: * Line 1, Column 2 Syntax error: Malformed token
Environment data
dotnet --version
output:
A JSON parsing exception occurred: * Line 1, Column 2 Syntax error: Malformed token
1.0.0-beta-002171
Issue Analytics
- State:
- Created 7 years ago
- Comments:28 (26 by maintainers)
Top Results From Across the Web
dotnet muxer reports JSON syntax error when global. ...
global.json is perfectly valid json file, it just has UTF8 BOM encoding which corehost can not process correctly. So yes, build would have ......
Read more >Unable to locate the .NET SDK as specified by global.json ...
I fixed this problem after discovering a global.json file at the directory root of a C# solution. This json file specified a specific...
Read more >global.json overview - .NET CLI
Learn how to use the global.json file to set the .NET SDK version when running .NET CLI commands.
Read more >Untitled
Castro ft d black sihor mp3 songs, #Sample barcode sheet pdf, Miguel simple things remix sharebeast, Pokemon sounds mp3 download, Syntax python pdf...
Read more >Untitled
Dust jacket book report, Colorin colorado este cuento no ha acabado audio ... songs wild world, Class diagram definition pdf format, Sql error...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This can be looked into fixing for future update - UTF8 is what we support (or lack of BOM). This can be called out in Release notes.
For UTF16 issue fix in a future update, please file a new issue and assign to @schellap
@gkhanna79 I just ran into this issue with a global.json that has a UTF-16 BOM.
I’m testing .NET on a Windows Nano Server container, so I used PowerShell’s Out-File cmdlet to create the global.json file, which appears to use UTF-16 by default.
I was able to work around the issue by removing the BOM by using
[IO.File]::WriteAllText
. I also verified that using a UTF-8 BOM is another workaround, e.g. by usingOut-File -Encoding utf8
.I’m wondering if it would be worth fixing this issue for UTF-16 in addition to UTF-8, because I think people might run into it, especially because the error message does not make it obvious what the problem is.
cc: @dleeapho @MichaelSimons