Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the bom from the data #2540

Merged
merged 3 commits into from
Sep 20, 2018
Merged

Conversation

akshita31
Copy link
Contributor

Fixes: #2521

We were getting the red flame because of a mono behavior, where if we set the encoding to UTF8 then a BOM(Byte Object Mark) is pushed into the stream (output as well as error) as the first character. In the extension we were listening to this input on the error stream and making the flame red.

So the workaround is to remove the "BOM" from the buffer and firing the "STDERR" event only if the length of the BOM is greater than 0.

This will also remove the stray character in the "OmniSharp" log that appears when using mono on Linux/Mac.
screenshot from 2018-09-18 15-20-36

@rchande
Copy link

rchande commented Sep 18, 2018

It's worth noting that this is a mono behavior. A console app that does nothing but set Console.OutputEncoding = Encoding.UTF8 will print a BOM after the encoding is set.

@codecov
Copy link

codecov bot commented Sep 19, 2018

Codecov Report

Merging #2540 into master will increase coverage by 0.07%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2540      +/-   ##
==========================================
+ Coverage   65.26%   65.33%   +0.07%     
==========================================
  Files          96       97       +1     
  Lines        4203     4212       +9     
  Branches      602      603       +1     
==========================================
+ Hits         2743     2752       +9     
+ Misses       1291     1290       -1     
- Partials      169      170       +1
Flag Coverage Δ
#integration 53.22% <83.33%> (-0.31%) ⬇️
#unit 84.67% <ø> (ø) ⬆️
Impacted Files Coverage Δ
src/utils/removeBOM.ts 100% <100%> (ø)
src/omnisharp/server.ts 71.67% <66.66%> (-0.06%) ⬇️
src/omnisharp/requestQueue.ts 81.81% <0%> (-3.04%) ⬇️
src/features/diagnosticsProvider.ts 76.81% <0%> (+2.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 53d4078...3f46a50. Read the comment docs.

@akshita31 akshita31 merged commit 43b6fb2 into dotnet:master Sep 20, 2018
@akshita31 akshita31 deleted the trim_stderr_data branch September 20, 2018 02:32
@akshita31 akshita31 mentioned this pull request Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants