question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Access to the path is denied.

See original GitHub issue

Checklist

Edition

Windows GUI Application

Describe your issue here

Application does not start.

System.UnauthorizedAccessException
  HResult=0x80070005
  Message=Access to the path 'C:\Users\PC\Desktop\ttvdl\TwitchDownloader\TwitchDownloaderWPF\bin\x64\Debug\net6.0-windows\Themes\README.txt' is denied.
  Source=System.Private.CoreLib
  StackTrace:
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.File.WriteAllText(String path, String contents)
   at TwitchDownloader.Tools.DefaultThemeService.WriteIncludedThemes() in C:\Users\PC\Desktop\ttvdl\TwitchDownloader\TwitchDownloaderWPF\Services\DefaultThemeService.cs:line 24
   at TwitchDownloader.Tools.ThemeService..ctor(App app, WindowsThemeService windowsThemeService) in C:\Users\PC\Desktop\ttvdl\TwitchDownloader\TwitchDownloaderWPF\Services\ThemeService.cs:line 30
   at TwitchDownloaderWPF.App.OnStartup(StartupEventArgs e) in C:\Users\PC\Desktop\ttvdl\TwitchDownloader\TwitchDownloaderWPF\App.xaml.cs:line 26
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

Issue Analytics

  • State:closed
  • Created 7 months ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
pablo-01commented, Feb 13, 2023

Avast Antivirus is causing that.

0reactions
ScrubNcommented, Feb 13, 2023

Do you have any restrictions set in the windows “privacy” settings regarding file system access? Maybe it’s possible that your machine refuses to give relative/envvar path access, only absolute paths?

Also on another dev branch there is a try-catch around the line that was causing the crash. I thought it was in master already but apparently not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Access to the path is denied when saving image
You are trying to save to a file that has the same name as the directory. That cannot work, you can't overwrite a...
Read more >
Access To Path Is Denied (Permissions Error)
Right-click on your directory that you want to access and select "Properties". · Select the "Security" tab. · Click on the "Advanced" button....
Read more >
Windows 10/11 "Access Denied" Folder Errors: 5 Easy Fixes
The most common fix to try when you see "folder access denied" is to take ownership of the folder through File Explorer. Here's...
Read more >
Access to the Path Is Denied
1) Open Windows Explorer · 2) Go to the Following directory: C:\users\[*username]\AppData\ · 3) Right Click on the folder Roaming · 4) Select ......
Read more >
"Access to the path [local working folder] is denied." when ...
Solution: · For Working Folder which is set in a network share, move it to the local workspace and try again. · Change...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found