Dyvinia / PlexampRPC

PlexampRPC displays currently playing Plex music as Discord Rich Presence, while using the proper Album Art
37 stars 3 forks source link

Access to the path '*\AppData\Roaming\PlexampRPC\auth' is denied. #1

Closed billwhy closed 1 year ago

billwhy commented 1 year ago

*When running the .exe it doesn't create the \AppData\Roaming\PlexampRPC\auth directory, so I manually created the directory and received this error:**

Access to the path '*\AppData\Roaming\PlexampRPC\auth' is denied.

at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)

at [Microsoft.Win32.SafeHandles.SafeFileHandle.Open](https://microsoft.win32.safehandles.safefilehandle.open/)(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable\1 unixCreateMode)`

at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)

at System.IO.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)

at PlexampRPC.App.PlexSignIn(Boolean resignIn) in D:\Development\repos\PlexampRPC\App.xaml.cs:line 93

at PlexampRPC.App.OnStartup(StartupEventArgs e) in D:\Development\repos\PlexampRPC\App.xaml.cs:line 75

at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)

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)
Dyvinia commented 1 year ago

Can you try with this PlexampRPC.zip

billwhy commented 1 year ago

This fixed it! Thanks for resolving this so promptly!

image

STRHercules commented 1 year ago

Same issue, I tried the new .exe you linked above and got this error:

Could not find a part of the path 'C:\Users\zkais\AppData\Roaming\PlexampRPC\auth.token'.

   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, Nullable`1 unixCreateMode)
   at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
   at PlexampRPC.App.PlexSignIn(Boolean resignIn) in D:\Development\repos\PlexampRPC\App.xaml.cs:line 93
   at PlexampRPC.App.OnStartup(StartupEventArgs e) in D:\Development\repos\PlexampRPC\App.xaml.cs:line 75
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   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)
Dyvinia commented 1 year ago

I think I might've made a silly mistake, try this to see if its fixed PlexampRPC.zip

STRHercules commented 1 year ago

That fixed it for me!

EDIT: I spoke too soon, after switching to another Plex Server I got this:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (IP ADDRESS:32400)

System.Net.Sockets.SocketException (10060): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)

   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Plex.ServerApi.Api.PlexRequestsHttpClient.SendAsync(HttpRequestMessage request)
   at Plex.ServerApi.Api.ApiService.InvokeApiAsync[T](ApiRequest request)
   at Plex.ServerApi.Clients.PlexServerClient.FetchWithWrapper[T](String baseUrl, String endpoint, String authToken, HttpMethod method, Dictionary`2 queryParams)
   at Plex.ServerApi.Clients.PlexServerClient.GetSessionsAsync(String authToken, String plexServerHost)
   at PlexampRPC.MainWindow.GetCurrentSession() in D:\Development\repos\PlexampRPC\Windows\MainWindow.xaml.cs:line 104
   at PlexampRPC.MainWindow.StartPolling() in D:\Development\repos\PlexampRPC\Windows\MainWindow.xaml.cs:line 87
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   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)

I omitted the actual IP Address in the error, it had my external IP in there.

Dyvinia commented 1 year ago

Does this work (I don't have multiple servers myself so I'm not able to test directly myself) PlexampRPC.zip

STRHercules commented 1 year ago

Negative, but it seems I was wrong in why it crashed earlier. Seems like its time based? I was able to select my server but it crashed shortly after. Same result no matter how many times I switch servers

Dyvinia commented 1 year ago

it seems it just can't connect to any servers, is the server accessable outside the network? (or maybe a firewall or something)

STRHercules commented 1 year ago

Yeah I have numerous users who live all over the country who have no issues

Dyvinia commented 1 year ago

Try the latest version, It doesn't solve issues with connecting but it should resolve crashes if it fails. Also closing this issue as the main/original issue is resolved, the connection issue has a new issue at #2