X2CommunityCore / xcom2-launcher

The Alternative Mod Launcher (AML) is a replacement for the default game launchers from XCOM 2 and XCOM Chimera Squad.
GNU General Public License v3.0
354 stars 52 forks source link

Weird issues related to unsubscribing mods. #6

Closed Proaxel closed 5 years ago

Proaxel commented 7 years ago

What happens is, when you unsubscribe to a mod through clicking Unsubscribe on the workshop page, then open the launcher, the "These mods no longer exist and have been hidden" message comes up, then when you hit continue, the "an exception occurred, see error.log for details" message comes up.

In this case, I uninstalled the mod "Mod Everything" and tried to open the launcher and here is the error.log:

`Access to the path 'C:\Games\Steam\steamapps\workshop\content\268500\622863565\Src\ModEverything\Classes' is denied.
Stack:
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.AddSearchableDirsToStack(SearchData localSearchData)
   at System.IO.FileSystemEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
   at XCOM2Launcher.Mod.ModEntry.GetUIScreenListenerOverrides()
   at XCOM2Launcher.Forms.MainForm.UpdateConflicts()
   at XCOM2Launcher.Forms.MainForm.UpdateInterface()
   at XCOM2Launcher.Forms.MainForm..ctor(Settings settings)
   at XCOM2Launcher.Program.Main()`

In order to get the launcher to work again, I had to go and delete the offending folder with Lockhunter. Lockhunter shows says that the process preventing access to the file is "igfxEM.exe". Once I deleted it the launcher worked again.

However, the mod still shows up in the Launcher if you set it to show hidden mods, under a "Not Installed" section. If you select the mod entry, the launcher immediately closes with this exception:

`Access to the path 'C:\Games\Steam\steamapps\workshop\content\268500\622863565\Config' is denied.
Stack:
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
   at XCOM2Launcher.Forms.MainForm.UpdateModInfo(ModEntry m)
   at XCOM2Launcher.Forms.MainForm.ModListSelectionChanged(Object sender, EventArgs e)
   at BrightIdeasSoftware.ObjectListView.OnSelectionChanged(EventArgs e)
   at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at XCOM2Launcher.Program.Main()`

I delete that folder with Lockhunter. It shows the same process locking it. I open the launcher again and right click on the mod and hit Delete/Unsubscribe. This exception occurs, but the launcher still works if you hit Continue and the mod entry is removed.

************** Exception Text **************
System.UnauthorizedAccessException: Access to the path 'C:\Games\Steam\steamapps\workshop\content\268500\622863565\Localization' is denied.
   at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
   at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
   at XCOM2Launcher.Forms.MainForm.DeleteMods()
   at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.MenuItem.MenuItemData.Execute()
   at System.Windows.Forms.Command.Invoke()
   at System.Windows.Forms.Control.WmCommand(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ListView.WndProc(Message& m)
   at BrightIdeasSoftware.ObjectListView.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

What is causing these weird glitches? What is this "igfxEM.exe" and why is it locking the launcher out of accessing these uninstalled files?

robojumper commented 7 years ago

Thanks for already finding out the cause of the issues. igfxEM.exe is part of Intel's graphics driver suite. Other people were having similar issues, see this discussion on intel forums and this discussion on Subnautica forums.

It does not appear there is an easy fix, but we can try to guard the IO calls so it doesn't crash and gives you an error popup with a more helpful message instead.

Proaxel commented 7 years ago

Installing the driver linked on the Intel forum seems to have fixed it. Thanks!

There seems to be another issue though, although it is not as crippling. You know how recently uninstalled mods still show up as "Not Installed" if you set the launcher to show hidden mods? If you try to get rid of these mods by right-clicking on them and selecting Delete/Unsubscribe, it causes this exception (but you can hit continue and the launcher will still work).

************** Exception Text **************
System.IO.IOException: The directory is not empty.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
   at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
   at XCOM2Launcher.Forms.MainForm.DeleteMods()
   at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.MenuItem.MenuItemData.Execute()
   at System.Windows.Forms.Command.Invoke()
   at System.Windows.Forms.Control.WmCommand(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ListView.WndProc(Message& m)
   at BrightIdeasSoftware.ObjectListView.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
korgano commented 7 years ago

This is probably related, since it popped up after the launcher decided not to detect all of my WIP/dev files for mods:

Sequence contains more than one matching element
Stack:
   at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at XCOM2Launcher.Mod.ModList.Import(String modDir, ModSource source)
   at XCOM2Launcher.Mod.ModList.ImportMods(String dir)
   at XCOM2Launcher.Settings.ImportMods()
   at XCOM2Launcher.Program.InitializeSettings()
   at XCOM2Launcher.Program.Main()