Vipermagi Posted February 22, 2019 Posted February 22, 2019 I spend a good little while trying to fix this problem and found no information on someone else encountering it so I wanted to document it when I could. PKHeX launches perfectly fine, however, if you go to file -> open, it immediately throws a fatal exception in the COM service. This Error isn't specifically caused by PKHeX (although it might be possible to code it to handle the exception and even work around it) but with Windows Themes. If Windows Themes is disabled (In Windows 7, 8, and 10), or if High Contrast Mode is enabled, it will cause this error preventing you from loading any files in PKHeX. I apologize if there is a more appropriate way to say this. Criticism welcome.
ReignOfComputer Posted February 23, 2019 Posted February 23, 2019 Could not reproduce. Can you attach a screenshot?
theSLAYER Posted February 23, 2019 Posted February 23, 2019 @Vipermagi not sure if I'm doing this right, but I set the theme to High Contrast and it still loaded a save just fine. The only thing that was hurt in this process, was my eyes XD Also just asking, if you drag a save file into the window (instead of using Open >> ), does it throw that exception? For the instance above, I used the Open >> option as you mentioned, to try to reproduce the error.
Vipermagi Posted February 23, 2019 Author Posted February 23, 2019 An Image of the Error given. A copy of the full Exception Details Spoiler Exception Details: System.Runtime.InteropServices.COMException (0x80040111): Creating an instance of the COM component with CLSID {DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7} from the IClassFactory failed due to the following error: 80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE)). at System.Windows.Forms.OpenFileDialog.CreateVistaDialog() at System.Windows.Forms.FileDialog.RunDialogVista(IntPtr hWndOwner) at System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner) at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner) at System.Windows.Forms.CommonDialog.ShowDialog() at PKHeX.WinForms.WinFormsUtil.OpenSAVPKMDialog(IEnumerable`1 Extensions, String& path) at PKHeX.WinForms.Main.MainMenuOpen(Object sender, EventArgs e) at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e) at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ToolStrip.WndProc(Message& m) at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) Loaded Assemblies: -------------------- mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll PKHeX, Version=19.2.7.0, Culture=neutral, PublicKeyToken=null C:\Users\samue\Desktop\PKHeX\PKHeX.exe System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll PKHeX.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null C:\Users\samue\Desktop\PKHeX\PKHeX.Core.dll System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll -------------------- User Message: An unhandled exception has occurred. You can continue running PKHeX, but please report this error. If I drag and drop the save file into PKHex, it does load (I didn't even know that was possible, thank you) however, if I try to save or export I get the exact same error again. How I came to the conclusion of Windows Theme being involved was due to this website here which was the first hit on Google when I pasted the "Exception Details" directly into Google. https://stackoverflow.com/questions/29929862/exception-from-hresult-0x80040111-class-e-classnotavailable And indeed, if I turn off high contrast mode, PKHeX works exactly as advertised (I would like to thank the devs for this product, it has given a few extra playthroughs worth of entertainment in my game, especially my gengar named §Laughter because the § renders incrementally changing his name between slaughter and laughter throughout the game).
Kaphotics Posted February 23, 2019 Posted February 23, 2019 https://stackoverflow.com/questions/16602256/80040111-classfactory-cannot-supply-requested-class-exception-from-hresult-0x8?noredirect=1 This also mentions running it as administrator; try giving that a shot. I don't really want to add in programmatic workarounds for Windows/WinForms specific bugs Now that there's a thread documenting the issue and a possible user-workaround, seems okay now. possible logic workarounds: https://blog.lextudio.com/openfiledialog-crashes-with-comexception-0x80040111-f51e18d1ab89?gi=87be3cc1be63 try { if (dialog.ShowDialog() == DialogResult.Cancel) { return; } } catch (COMException ex) { if (ex.StackTrace.Contains("System.Windows.Forms.OpenFileDialog.CreateVistaDialog()")) { // IMPORTANT: use a workaround to suppress failure. dialog.AutoUpgradeEnabled = false; if (dialog.ShowDialog() == DialogResult.Cancel) { return; } } }
Vipermagi Posted February 23, 2019 Author Posted February 23, 2019 Administrator does not appear to make any difference on it. The best I can determine, it's a Windows problem, an intermittent problem, and now a documented problem. Hopefully, the next poor sap to run into this issue can find this post and experiences less aggravation. Thank you for your time and consideration. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now