CmlLib / CmlLib.Core.Auth.Microsoft

Minecraft Login with Microsoft Xbox account
MIT License
22 stars 4 forks source link

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

Closed voidZiAD closed 9 months ago

voidZiAD commented 9 months ago
  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 commented 9 months ago

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

voidZiAD commented 9 months ago

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

voidZiAD commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

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