JiayiSoftware / JiayiLauncher

Minecraft for Windows mod manager
https://jiayisoftware.github.io/launcher
GNU General Public License v3.0
66 stars 18 forks source link

very deep crash when trying to switch versions #24

Closed phasephasephase closed 1 year ago

phasephasephase commented 1 year ago

log for reference:

[...]
[18:55:36] [VersionManager - Info]: Switching to version 1.18.12.1
[18:55:36] [TargetInvocationException - Error]: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidCastException: Specified cast is not valid.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at WinRT.IObjectReference.As[T](Guid iid)
   at WinRT.IObjectReference.As[T]()
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at WinRT.SingleInterfaceOptimizedObject..ctor(Type type, IObjectReference objRef, Boolean requireQI)
   at WinRT.SingleInterfaceOptimizedObject..ctor(Type type, IObjectReference objRef)
   at Windows.Storage.ApplicationData.Make__lazy_global__System_IDisposable()
   at Windows.Storage.ApplicationData.AsInternal(InterfaceTag`1 _)
   at Windows.Storage.ApplicationData.Dispose()
   at JiayiLauncher.Features.Versions.VersionManager.Switch(String version) in D:\projects\JiayiLauncher\JiayiLauncher\Features\Versions\VersionManager.cs:line 135
   at JiayiLauncher.Pages.Extra.FullVersionList.SwitchClicked(String ver) in D:\projects\JiayiLauncher\JiayiLauncher\Pages\Extra\FullVersionList.razor:line 215
   at JiayiLauncher.Pages.Extra.FullVersionList.<>c__DisplayClass0_0.<<BuildRenderTree>b__6>d.MoveNext() in D:\projects\JiayiLauncher\JiayiLauncher\Pages\Extra\FullVersionList.razor:line 67
[...]

i think it's an issue with winrt because of how deep this stack trace is but i could be wrong

phasephasephase commented 1 year ago

i've gotten a bit far with removing the using statement before ApplicationDataManager.CreateForPackageFamily but typically people who get this error can't access their game data folder, will investigate a little further