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.ArgumentException: 'The path is not of a legal form.' #19

Closed
voidZiAD opened this issue Jan 25, 2024 · 5 comments
Closed

System.ArgumentException: 'The path is not of a legal form.' #19

voidZiAD opened this issue Jan 25, 2024 · 5 comments

Comments

@voidZiAD
Copy link

voidZiAD commented Jan 25, 2024

  HResult=0x80070057
  Message=The path is not of a legal form.
  Source=mscorlib
  StackTrace:
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.InternalGetDirectoryName(String path)
   at Microsoft.Web.WebView2.Core.CoreWebView2Environment.GetAssemblyLocationDirectory()
   at Microsoft.Web.WebView2.Core.CoreWebView2Environment.LoadWebView2LoaderDll()
   at Microsoft.Web.WebView2.Core.CoreWebView2Environment.GetAvailableBrowserVersionString(String browserExecutableFolder)
   at XboxAuthNet.Platforms.WinForm.WebView2WebUI.IsWebView2Available()
   at XboxAuthNet.PlatformManager.CreateWebUI(WebUIOptions uiOptions)
   at XboxAuthNet.OAuth.CodeFlow.CodeFlowBuilder.createDefaultWebUIForPlatform()
   at XboxAuthNet.OAuth.CodeFlow.CodeFlowBuilder.Build()
   at XboxAuthNet.Game.OAuth.InteractiveMicrosoftOAuth.<Authenticate>d__3.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at XboxAuthNet.Game.OAuth.MicrosoftOAuth.<Authenticate>d__2.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at XboxAuthNet.Game.Authenticators.SessionAuthenticator`1.<ExecuteAsync>d__6.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at XboxAuthNet.Game.Authenticators.NestedAuthenticator.<doInnerAuth>d__6.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at XboxAuthNet.Game.Authenticators.NestedAuthenticator.<doInnerAuth>d__6.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at XboxAuthNet.Game.Authenticators.NestedAuthenticator.<doInnerAuth>d__6.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at XboxAuthNet.Game.Authenticators.NestedAuthenticator.<ExecuteAsync>d__5.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at XboxAuthNet.Game.Authenticators.NestedAuthenticator.<ExecuteAsync>d__4.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at CmlLib.Core.Auth.Microsoft.Extensions.<ExecuteForLauncherAsync>d__10.MoveNext() in C:\Users\pronn\Downloads\CmlLib.Core.Auth.Microsoft-dev\CmlLib.Core.Auth.Microsoft-dev\src\CmlLib.Core.Auth.Microsoft\Extensions.cs:line 88
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Leaf_Client.MainForm.<btnFTMicrosoft_Click>d__7.MoveNext() in C:\Users\pronn\Downloads\CmlLib.Core-master\CmlLib.Core-master\Leaf Client\MainForm.cs:line 94

Code:

var loginHandler = JELoginWrapper.Instance.LoginHandler;
//var session = await loginHandler.AuthenticateInteractively();
var authenticator = loginHandler.CreateAuthenticatorWithNewAccount();
authenticator.AddForceMicrosoftOAuthForJE(oauth => oauth.Interactive());
authenticator.AddXboxAuthForJE(xbox => xbox.Basic());
authenticator.AddForceJEAuthenticator();
var session = await authenticator.ExecuteForLauncherAsync();
Console.WriteLine("Logged in successfully with account " + session.Username + ".");```
@voidZiAD
Copy link
Author

Why is this happening? And what's the fix?

@voidZiAD
Copy link
Author

Btw I'm using .NET WinForms, is that the issue?

@voidZiAD
Copy link
Author

I also tried this:

var loginHandler = JELoginHandlerBuilder.BuildDefault();
//var session = await loginHandler.Authenticate();
var session = await loginHandler.AuthenticateInteractively();
Console.WriteLine("Logged in successfully with account " + session.Username + ".");

But I still get the same issue.

@voidZiAD
Copy link
Author

voidZiAD commented Jan 25, 2024

So I found the solution, and the issue.

Issue: WebView2 & Fody.Costura packages

Solution: All you have to do is literally just update the packages that come with CmLib's packages (including WebView2, Fody.Costura). It's been fixed in the new versions so that's great. I recommend you pin this issue just in case anyone has the same one.

@AlphaBs
Copy link
Member

AlphaBs commented Jan 27, 2024

I also suffered this issue with WebView2 and Fody before. thank you for reporting

@AlphaBs AlphaBs pinned this issue Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants