Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

dotnet-watch prints invalid characters in Command Prompt #265

Closed
justdmitry opened this issue Feb 20, 2017 · 11 comments
Closed

dotnet-watch prints invalid characters in Command Prompt #265

justdmitry opened this issue Feb 20, 2017 · 11 comments

Comments

@justdmitry
Copy link

dotnet-watch prints unknown/non-ascii characters in log messages (red boxes on image).

cmd_2017-02-20_13-52-32

Package used: Microsoft.DotNet.Watcher.Tools version 1.0.0-msbuild3-final

Environment: win10-x64, SDK 1.0.0-rc4-004771, console encoding utf-8 (green on image)

Possibly related with https://github.com/dotnet/cli/issues/2590

@natemcmaster
Copy link
Contributor

Can confirm. This only appears in Command Prompt, which doesn't support ANSI color codes. To workaround, use basically any other shell, like PowerShell, ConEmu, etc.

@Eilon Eilon added the 1 - Ready label Mar 3, 2017
@Eilon Eilon added this to the 1.0.1 milestone Mar 3, 2017
@Eilon
Copy link
Member

Eilon commented Mar 3, 2017

Will consider this for a 1.0.1 patch of this package.

@natemcmaster natemcmaster self-assigned this Mar 10, 2017
@natemcmaster natemcmaster changed the title dotnet-watch prints invalid characters dotnet-watch prints invalid characters in Command Prompt Mar 10, 2017
@Eilon
Copy link
Member

Eilon commented Mar 14, 2017

@natemcmaster is this bug meant for the patch or for dev (2.0.0-preview1)? For dev I see you merged the change in - that's good. But then this bug should move to the correct milestone, and I guess we need a new bug opened for 1.0.1?

@natemcmaster
Copy link
Contributor

@Eilon I'm honestly confused about whether we have 1.0.1 planned or not. Feel free to move milestones/create duplicates as necessary to satisfy bookkeeping procedures.

@snerks
Copy link

snerks commented Mar 27, 2017

Issue appears to exist in Nightly Build for Windows 7 (SP1) 64-bit.

Steps to reproduce:
Follow steps provided in the blog post written by @shanselman, to create a solution, containing a Class Library and a Unit Test library:
https://www.hanselman.com/blog/CommandLineUsingDotnetWatchTestForContinuousTestingWithNETCore10AndXUnitnet.aspx

Download ZIP of latest Windows X64 SDK:
https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-dev-win-x64.latest.zip

Unzip the file. Place the contents of the unzipped dotnet-dev-win-x64.latest folder in the test project folder in the source code (i.e. the mytests folder, described in the blog post written by @shanselman) :

Open a command line (cmd.exe)
Navigate to the mytests folder

Type dotnet --version
2.0.0-preview1-005660

Type dotnet watch run

Expected result:
No garbled characters in console output

Actual result:
Garbled characters in console output
Note: I'm also seeing character-encoding issues in cmd.exe (and Powershell) but not Git-Bash.
image

It's possible I have missed some necessary steps.

@natemcmaster
Copy link
Contributor

@snerks what is your version of Microsoft.DotNet.Watcher.Tools? (look for DotNetCliToolReference or dotnet watch --version)

@snerks
Copy link

snerks commented Mar 27, 2017

dotnet watch --version
1.0.0-rtm-10308.

Do I need to take steps to update this to nightly version?

@natemcmaster
Copy link
Contributor

Your steps may have updated dotnet-CLI, but you're still using dotnet-watch 1.0.0. To use nightly,

  1. add a nuget.config file to our nightly feed. See the NuGet.config file in this repo for example
  2. Change the version in csproj:
    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.2.0-*" />
  3. dotnet restore
  4. dotnet watch --version to ensure it was installed.

See https://dotnet.myget.org/feed/aspnetcore-ci-dev/package/nuget/Microsoft.DotNet.Watcher.Tools.
FYI 1.2.0-* is a placeholder version that won't be released. This will be renamed to 2.0.0 soon.

@snerks
Copy link

snerks commented Mar 27, 2017

Problem with dotnet restore now...

D:\DotNetCore.Nightly\dotnet-dev-win-x64.latest\testexample\mytests>dotnet resto
re

Restoring packages for D:\DotNetCore.Nightly\dotnet-dev-win-x64.latest\testexa
mple\mytests\mytests.csproj...
Restoring packages for D:\DotNetCore.Nightly\dotnet-dev-win-x64.latest\testexa
mple\mylibrary\mylibrary.csproj...
Restoring packages for D:\DotNetCore.Nightly\dotnet-dev-win-x64.latest\testexa
mple\mytests\mytests.csproj...
Generating MSBuild file D:\DotNetCore.Nightly\dotnet-dev-win-x64.latest\testex
ample\mylibrary\obj\mylibrary.csproj.nuget.g.props.
Writing lock file to disk. Path: D:\DotNetCore.Nightly\dotnet-dev-win-x64.late
st\testexample\mylibrary\obj\project.assets.json
Restore completed in 30.45 sec for D:\DotNetCore.Nightly\dotnet-dev-win-x64.la
test\testexample\mylibrary\mylibrary.csproj.
D:\DotNetCore.Nightly\dotnet-dev-win-x64.latest\testexample\mytests\sdk\2.0.0-pr
eview1-005660\NuGet.targets(97,5): error : Unable to resolve 'Microsoft.DotNet.W
atcher.Tools (>= 1.2.0)' for '.NETCoreApp,Version=v1.0'. [D:\DotNetCore.Nightly
dotnet-dev-win-x64.latest\testexample\mytests\mytests.csproj]
D:\DotNetCore.Nightly\dotnet-dev-win-x64.latest\testexample\mytests\sdk\2.0.0-pr
eview1-005660\NuGet.targets(97,5): error : Value cannot be null.\r [D:\DotNetCor
e.Nightly\dotnet-dev-win-x64.latest\testexample\mytests\mytests.csproj]
D:\DotNetCore.Nightly\dotnet-dev-win-x64.latest\testexample\mytests\sdk\2.0.0-pr
eview1-005660\NuGet.targets(97,5): error : Parameter name: path [D:\DotNetCore.N
ightly\dotnet-dev-win-x64.latest\testexample\mytests\mytests.csproj]

@natemcmaster
Copy link
Contributor

@snerks this error looks like a NuGet bug. https://github.com/NuGet/Home is the right place for this. I'd recommend using dotnet-CLI 1.0.0 instead if you're simply trying to use a new version of dotnet-watch. The latest 1.2.0-* version of Microsoft.DotNet.Watcher.Tools doesn't need dotnet-CLI 2.0.0-preview1. Combining nightlies of dotnet CLI and NuGet and dotnet-watch is going to be unstable.

@snerks
Copy link

snerks commented Mar 27, 2017

@natemcmaster - I've made progress on this.

To workaround the NuGet issue above, I downloaded the Nightly Microsoft.DotNet.Watcher.Tools NuGet package to disk from:
https://dotnet.myget.org/feed/aspnetcore-ci-dev/package/nuget/Microsoft.DotNet.Watcher.Tools/1.2.0-preview1-24137

I then added a Nuget Package source that points to my on-disk Nuget packages folder.

Finally, I added a reference to the exact version of Microsoft.DotNet.Watcher.Tools to my unit test project (mytests.csproj):

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.2.0-preview1-24137" />
  </ItemGroup>

Then, following the steps in the blog item by @shanselman, I now see the following:

  1. No garbled characters - nice!
  2. Colorisation - nicer!

cmd.exe:

image

Powershell:

image

FYI: Git Shell does not show colorisation - not sure if this is expected.

Thanks @natemcmaster for helping to resolve my issue and @shanselman for the blog post.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants