Skip to content

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

Closed

Description

@xauuzd
  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 + ".");```

Activity

  1. xauuzd commented on Jan 25, 2024

    @xauuzd
    Author

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

  2. xauuzd commented on Jan 25, 2024

    @xauuzd
    Author

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

  3. xauuzd commented on Jan 25, 2024

    @xauuzd
    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.

  4. xauuzd commented on Jan 25, 2024

    @xauuzd
    Author

    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.

  5. AlphaBs commented on Jan 27, 2024

    @AlphaBs
    Member

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

  6. pinned this issue on Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions