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

Unhandled Exception on Windows 7 #12

Open
shahabganji opened this issue Oct 16, 2018 · 19 comments
Open

Unhandled Exception on Windows 7 #12

shahabganji opened this issue Oct 16, 2018 · 19 comments
Labels

Comments

@shahabganji
Copy link

shahabganji commented Oct 16, 2018

Hello @terrajobst

I have installed the tool via this command dotnet tool install git-istage -g and I get the following error when running the git istage command, or git istage .:

Unhandled Exception: System.IO.IOException: The handle is invalid
   at System.ConsolePal.get_CursorVisible()
   at GitIStage.Application.Run() in /home/vsts/work/1/s/src/git-istage/Application.cs:line 33
   at GitIStage.Program.Main() in /home/vsts/work/1/s/src/git-istage/Program.cs:line 32

I just created a folder and within that, I have created a new git repository by caling git init, then added a simple txt file and add Hello World text inside that. then I ran git istage . and I get the above mentioned error.

  • worth to note that I am running Windows 7

and here is my dotnet --info output

.NET Core SDK (reflecting any global.json):
 Version:   2.1.403
 Commit:    04e15494b6

Runtime Environment:
 OS Name:     Windows
 OS Version:  6.1.7601
 OS Platform: Windows
 RID:         win7-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.403\

Host (useful for support):
  Version: 2.1.5
  Commit:  290303f510

.NET Core SDKs installed:
  2.1.402 [C:\Program Files\dotnet\sdk]
  2.1.403 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
@drewnoakes
Copy link

What terminal/console program are you using?

@shahabganji
Copy link
Author

shahabganji commented Oct 16, 2018

@drewnoakes

I am using Git Bash (MINGW64) on Windows 7.

  • This might be helpful to know when using git bash as VS Code's terminal it has no problem, but when i open the bash from explorer on my git repository folder it fails with the exception.

@drewnoakes
Copy link

Sounds like #9. Does it work in cmd.exe?

@shahabganji
Copy link
Author

That works with cmd.exe it also works with git bash as VS Code's internal terminal.

@jvlppm
Copy link

jvlppm commented Oct 17, 2018

I have this same issue when running under OSX Mojave, the default terminal.

@terrajobst
Copy link
Owner

terrajobst commented Oct 18, 2018

To be honest, I haven't tested Unix/macOS yet so I'd understand why that would fail. Not sure why the Windows ones fail though. I'll investigate.

@terrajobst
Copy link
Owner

terrajobst commented Oct 18, 2018

  • worth to note that I am running Windows 7

Ah, just noticed you're on Win7. I'm on Win10. Maybe there is an accidental dependency somewhere that requires Win 10. I'll check.

@shahabganji
Copy link
Author

shahabganji commented Oct 18, 2018

Dear @terrajobst,

To be honest, I haven't tested Unix/macOS yet so I'd understand why that would fail. Not sure why the Windows ones fail though. I'll investigate.

I have also checked on Mac OSX ( macOS High Sierra Version 10.13.3 ), it does not even understand the istage command.

I did the following steps:

  1. dotnet new install -g git-istage
  2. In a git dircetory I ran : git istage .

and I failed with the an error message:

git: 'istage' is not a git command. See 'git --help'.

The most similar command is
	stage

here is the output for dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   2.2.100-preview2-009404
 Commit:    f4707d384d

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.13-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.2.100-preview2-009404/

Host (useful for support):
  Version: 2.2.0-preview2-26905-02
  Commit:  ad4d306fe0

.NET Core SDKs installed:
  2.1.4 [/usr/local/share/dotnet/sdk]
  2.1.104 [/usr/local/share/dotnet/sdk]
  2.1.300-preview1-008174 [/usr/local/share/dotnet/sdk]
  2.1.300-rc1-008673 [/usr/local/share/dotnet/sdk]
  2.1.300 [/usr/local/share/dotnet/sdk]
  2.1.301 [/usr/local/share/dotnet/sdk]
  2.1.402 [/usr/local/share/dotnet/sdk]
  2.2.100-preview2-009404 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0-preview1-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.0-rc1-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.0-preview2-35157 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0-preview1-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.0-rc1-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.0-preview2-35157 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0-preview1-26216-03 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0-rc1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0-preview2-26905-02 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

@tiesmaster
Copy link

@shahabganji Does the command $ git-istage even work (so without having git invoking istage)? Since that might be an issue with .NET Global tools. I have the same on ZSH. I have solved that by following @gabrielrb approach.

When I then run istage, from a git repository, I still get this (and mine issue #9).

@shahabganji
Copy link
Author

shahabganji commented Oct 18, 2018 via email

@shahabganji
Copy link
Author

shahabganji commented Oct 22, 2018

@terrajobst , @tiesmaster

It still does not work on macOSX 10.13.3, I have added the dotnet tools folder to the PATH:

#Folders: 
export DOTNET_TOOLS_HOME=$HOME/.dotnet/tools

# Binaries:
export PATH=DOTNET_TOOLS_HOME:$PATH

however, when I run git-istage in the terminal it works, but when I run git istage it says no such a command found!

git: 'istage' is not a git command. See 'git --help'.

The most similar command is
	stage

My git versions is 2.16.2

Thanks anyway.

-------- EDIT ---------

To make it work env variables should be like the following, a $ is missed on the above snippet

#Folders: 
export DOTNET_TOOLS_HOME=$HOME/.dotnet/tools

# Binaries:
export PATH=$DOTNET_TOOLS_HOME:$PATH

@shahabganji
Copy link
Author

shahabganji commented Oct 22, 2018

@terrajobst , @tiesmaster

On my Windows 7 machine, the problem does exist too with the new version; and my git version on windows 7 is git version 2.9.0.windows.1.

  • PS 1: May find it fruitful to know that on my Mac machine I have dotnet 2.2.100-preview2-009404, and on my Windows 7 machine it is 2.1.403

  • PS 2: On Windows 7, Command Prompt has the same problem as I described for the Mac, In powershell it works just fine and seamlessly. In Git Bash Terminal( MINGW64 ) it is just as I described here

Thanks

@tiesmaster
Copy link

@shahabganji I'll check tomorrow on my Windows box.

@terrajobst
Copy link
Owner

terrajobst commented Oct 22, 2018

owever, when I run git-istage in the terminal it works, but when I run git istage it says no such a command found!

That's bad. I believe that's tracked by #21 now.

@shahabganji

On my Windows 7 machine, the problem does exist too with the new version

What error do you get? I no longer call get_CursorVisible, so that must be something new then.

@terrajobst terrajobst reopened this Oct 22, 2018
@tiesmaster
Copy link

I just upgraded from 0.2.2 to 0.2.29, and it's still failing under Git for Windows (using bash as shell), however, the stacktrace is now:

Unhandled Exception: System.IO.IOException: The handle is invalid
   at System.ConsolePal.set_CursorVisible(Boolean value)
   at GitIStage.Application.Run() in /home/vsts/work/1/s/src/git-istage/Application.cs:line 86
   at GitIStage.Program.Main() in /home/vsts/work/1/s/src/git-istage/Program.cs:line 32

Which makes sense, as usage of get_CursorVisible was removed in 9b9814e, however, set_CursorVisible is still there on L106.

@shahabganji
Copy link
Author

@terrajobst

What error do you get? I no longer call get_CursorVisible, so that must be something new then.

Unhandled Exception: System.IO.IOException: The handle is invalid
   at System.ConsolePal.set_CursorVisible(Boolean value)
   at GitIStage.Application.Run() in /home/vsts/work/1/s/src/git-istage/Application.cs:line 86
   at GitIStage.Program.Main() in /home/vsts/work/1/s/src/git-istage/Program.cs:line 32

@shahabganji
Copy link
Author

@tiesmaster

Can you also check on VS Code terminal, my VS Code terminal is set to Git Bash, and I don't get any error when running the command there.

CC: @terrajobst

@tiesmaster
Copy link

@shahabganji Ah, funny. Works in VS Code indeed. That's really odd...

@tomaszprasolek
Copy link
Contributor

tomaszprasolek commented Oct 29, 2018

I also have that Exception, but when I launch git bash from path C:\Program Files\Git\bin\sh.exe it works normally. Default path for git bash for windows is: C:\Program Files\Git\git-bash.exe.

I work on Windows 8.1.

@terrajobst terrajobst changed the title Unhandled Exception Unhandled Exception on Windows 7 Dec 6, 2018
@terrajobst terrajobst added the bug label Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants