Skip to content

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

Description

@sharpninja

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Consoleneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions