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

"System.UnauthorizedAccessException: Access to the path is denied." from Console.WriteLine on Ubuntu 20.10 #48654

Closed
sharpninja opened this issue Feb 19, 2021 · 5 comments
Labels
area-System.Console needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration
Milestone

Comments

@sharpninja
Copy link

When writing to the Console on Ubuntu 20.04 from the latest Dotnet Core 5.0 SDK Snap Package, System.UnauthorizedAccessException: Access to the path is denied. is thrown.

You can find affected code at sharpninja/FizzBuzz (look in any of the Dotnet projects under src) and compiled binaries.

Configuration

.Net SDK 5.0.103

> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.10
Release:        20.10
Codename:       groovy

> inxi -F                  
System:    Host: ##### Kernel: 5.8.0-44-generic x86_64 bits: 64 Console: tty 9 Distro: Ubuntu 20.10 (Groovy Gorilla) 
Machine:   Type: Desktop Mobo: ASRock model: X470 Master SLI/ac serial: <superuser/root required> UEFI: American Megatrends 
           v: P1.50 date: 11/06/2018 
CPU:       Info: 8-Core model: AMD Ryzen 7 2700X bits: 64 type: MT MCP L2 cache: 4096 KiB 
           Speed: 1886 MHz min/max: 2200/3700 MHz Core speeds (MHz): 1: 1885 2: 2017 3: 2195 4: 2151 5: 1888 6: 1891 7: 1886 
           8: 1888 9: 1888 10: 1890 11: 1887 12: 1890 13: 1994 14: 2049 15: 1884 16: 1897 
Graphics:  Device-1: NVIDIA GP107 [GeForce GTX 1050 Ti] driver: nvidia v: 460.32.03 
           Display: server: X.org 1.20.9 driver: nvidia unloaded: fbdev,modesetting,nouveau,vesa tty: 156x16 
           Message: Advanced graphics data unavailable in console. Try -G --display 
Audio:     Device-1: NVIDIA GP107GL High Definition Audio driver: snd_hda_intel 
           Device-2: Advanced Micro Devices [AMD] Family 17h HD Audio driver: snd_hda_intel 
           Device-3: Sunplus Innovation Live Camera type: USB driver: snd-usb-audio,uvcvideo 
           Device-4: Logitech Logitech USB Headset type: USB driver: hid-generic,snd-usb-audio,usbhid 
           Sound Server: ALSA v: k5.8.0-44-generic 
Network:   Device-1: Intel Dual Band Wireless-AC 3168NGW [Stone Peak] driver: iwlwifi 
           IF: wlp30s0 state: up mac: 94:b8:6d:ce:67:60 
           Device-2: Intel I211 Gigabit Network driver: igb 
           IF: enp31s0 state: down mac: 70:85:c2:84:c6:f7 
Drives:    Local Storage: total: 3.22 TiB used: 1.89 TiB (58.6%) 
           ID-1: /dev/nvme0n1 vendor: Intel model: SSDPEKNW010T8 size: 953.87 GiB 
           ID-2: /dev/sda vendor: Seagate model: ST2000DM001-1CH164 size: 1.82 TiB 
           ID-3: /dev/sdb vendor: SK Hynix model: HFS512G39TND-N210A size: 476.94 GiB 
Partition: ID-1: / size: 937.40 GiB used: 26.69 GiB (2.8%) fs: ext4 dev: /dev/nvme0n1p3 
Swap:      ID-1: swap-1 type: file size: 2.00 GiB used: 0 KiB (0.0%) file: /swapfile 
Sensors:   System Temperatures: cpu: 38.4 C mobo: N/A gpu: nvidia temp: 32 C 
           Fan Speeds (RPM): N/A gpu: nvidia fan: 0% 
Info:      Processes: 392 Uptime: 19h 27m Memory: 31.35 GiB used: 5.84 GiB (18.6%) Init: systemd runlevel: 5 Shell: pwsh 
           inxi: 3.1.07 

Regression?

I do not know if the problem previously existed.

Other information

Unhandled exception. System.UnauthorizedAccessException: Access to the path is denied.
 ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at System.ConsolePal.Write(SafeFileHandle fd, Byte* bufPtr, Int32 count, Boolean mayChangeCursorPosition)
   at System.ConsolePal.Write(SafeFileHandle fd, Byte[] buffer, Int32 offset, Int32 count, Boolean mayChangeCursorPosition)
   at System.ConsolePal.UnixConsoleStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.IO.StreamWriter.WriteLine(String value)
   at System.IO.TextWriter.SyncTextWriter.WriteLine(String value)
   at System.Console.WriteLine(String value)
   at FizzBuzz.Program.Main(String[] _) in /media/ninja/Programs/GitHub/FizzBuzz/src/CSharp/Program.cs:line 19
@eiriktsarpalis eiriktsarpalis transferred this issue from dotnet/core Feb 23, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.IO untriaged New issue has not been triaged by the area owner labels Feb 23, 2021
@ghost
Copy link

ghost commented Feb 23, 2021

Tagging subscribers to this area:
See info in area-owners.md if you want to be subscribed.

Issue Details

When writing to the Console on Ubuntu 20.04 from the latest Dotnet Core 5.0 SDK Snap Package, System.UnauthorizedAccessException: Access to the path is denied. is thrown.

You can find affected code at sharpninja/FizzBuzz (look in any of the Dotnet projects under src) and compiled binaries.

Configuration

.Net SDK 5.0.103

> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.10
Release:        20.10
Codename:       groovy

> inxi -F                  
System:    Host: ##### Kernel: 5.8.0-44-generic x86_64 bits: 64 Console: tty 9 Distro: Ubuntu 20.10 (Groovy Gorilla) 
Machine:   Type: Desktop Mobo: ASRock model: X470 Master SLI/ac serial: <superuser/root required> UEFI: American Megatrends 
           v: P1.50 date: 11/06/2018 
CPU:       Info: 8-Core model: AMD Ryzen 7 2700X bits: 64 type: MT MCP L2 cache: 4096 KiB 
           Speed: 1886 MHz min/max: 2200/3700 MHz Core speeds (MHz): 1: 1885 2: 2017 3: 2195 4: 2151 5: 1888 6: 1891 7: 1886 
           8: 1888 9: 1888 10: 1890 11: 1887 12: 1890 13: 1994 14: 2049 15: 1884 16: 1897 
Graphics:  Device-1: NVIDIA GP107 [GeForce GTX 1050 Ti] driver: nvidia v: 460.32.03 
           Display: server: X.org 1.20.9 driver: nvidia unloaded: fbdev,modesetting,nouveau,vesa tty: 156x16 
           Message: Advanced graphics data unavailable in console. Try -G --display 
Audio:     Device-1: NVIDIA GP107GL High Definition Audio driver: snd_hda_intel 
           Device-2: Advanced Micro Devices [AMD] Family 17h HD Audio driver: snd_hda_intel 
           Device-3: Sunplus Innovation Live Camera type: USB driver: snd-usb-audio,uvcvideo 
           Device-4: Logitech Logitech USB Headset type: USB driver: hid-generic,snd-usb-audio,usbhid 
           Sound Server: ALSA v: k5.8.0-44-generic 
Network:   Device-1: Intel Dual Band Wireless-AC 3168NGW [Stone Peak] driver: iwlwifi 
           IF: wlp30s0 state: up mac: 94:b8:6d:ce:67:60 
           Device-2: Intel I211 Gigabit Network driver: igb 
           IF: enp31s0 state: down mac: 70:85:c2:84:c6:f7 
Drives:    Local Storage: total: 3.22 TiB used: 1.89 TiB (58.6%) 
           ID-1: /dev/nvme0n1 vendor: Intel model: SSDPEKNW010T8 size: 953.87 GiB 
           ID-2: /dev/sda vendor: Seagate model: ST2000DM001-1CH164 size: 1.82 TiB 
           ID-3: /dev/sdb vendor: SK Hynix model: HFS512G39TND-N210A size: 476.94 GiB 
Partition: ID-1: / size: 937.40 GiB used: 26.69 GiB (2.8%) fs: ext4 dev: /dev/nvme0n1p3 
Swap:      ID-1: swap-1 type: file size: 2.00 GiB used: 0 KiB (0.0%) file: /swapfile 
Sensors:   System Temperatures: cpu: 38.4 C mobo: N/A gpu: nvidia temp: 32 C 
           Fan Speeds (RPM): N/A gpu: nvidia fan: 0% 
Info:      Processes: 392 Uptime: 19h 27m Memory: 31.35 GiB used: 5.84 GiB (18.6%) Init: systemd runlevel: 5 Shell: pwsh 
           inxi: 3.1.07 

Regression?

I do not know if the problem previously existed.

Other information

Unhandled exception. System.UnauthorizedAccessException: Access to the path is denied.
 ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at System.ConsolePal.Write(SafeFileHandle fd, Byte* bufPtr, Int32 count, Boolean mayChangeCursorPosition)
   at System.ConsolePal.Write(SafeFileHandle fd, Byte[] buffer, Int32 offset, Int32 count, Boolean mayChangeCursorPosition)
   at System.ConsolePal.UnixConsoleStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.IO.StreamWriter.WriteLine(String value)
   at System.IO.TextWriter.SyncTextWriter.WriteLine(String value)
   at System.Console.WriteLine(String value)
   at FizzBuzz.Program.Main(String[] _) in /media/ninja/Programs/GitHub/FizzBuzz/src/CSharp/Program.cs:line 19
Author: sharpninja
Assignees: -
Labels:

area-System.Console, area-System.IO, untriaged

Milestone: -

@jozkee
Copy link
Member

jozkee commented Feb 25, 2021

@sharpninja are you able to repro this consistently? Could you please verify installing .NET with a method other than snap? How do you start the process, are you redirecting the standard output?

@jozkee jozkee added needs author feedback and removed untriaged New issue has not been triaged by the area owner labels Feb 25, 2021
@jozkee jozkee added this to the Future milestone Feb 25, 2021
@sharpninja
Copy link
Author

sharpninja commented Feb 26, 2021

Yes, it happens every time. That GitHub repo has five different .Net Projects (3x C#, 1x F# and 1x VB.Net) that exhibit the same behavior.

Edit: I will try to install via the install_dotnet script tonight and test that way.

@ghost ghost added needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration and removed needs author feedback labels Feb 26, 2021
@adamsitnik
Copy link
Member

Hi @sharpninja

I've taken a look at the example that you have provided and I can't find a reason why it would be throwing.

May I ask how exactly do you run the app? Which terminal are you using? How is the dotnet process being started? Is the input reditected? Is there a script that I could run to repro it?

Thanks,
Adam

@adamsitnik
Copy link
Member

May I ask how exactly do you run the app? Which terminal are you using? How is the dotnet process being started? Is the input reditected? Is there a script that I could run to repro it?

No response for 2 years, closing.

@adamsitnik adamsitnik closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Console needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration
Projects
None yet
Development

No branches or pull requests

4 participants