mortenn / BrowserPicker

Smart browser selector for Windows
MIT License
244 stars 17 forks source link

[1.8.2] Launching Throws Exception #47

Closed GravlLift closed 3 years ago

GravlLift commented 3 years ago

When I open any link using the new release, 1.8.2, I get the following exception in a message box:

---------------------------

---------------------------
Value cannot be null.

Parameter name: name   at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)

   at Microsoft.Win32.RegistryKey.ValidateKeyName(String name)

   at Microsoft.Win32.RegistryKey.CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, Object registrySecurityObj, RegistryOptions registryOptions)

   at Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, Boolean writable)

   at BrowserPicker.Configuration.Config.SetBrowsers(IEnumerable`1 browsers)

   at BrowserPicker.ViewModel.FindBrowsers()

   at BrowserPicker.ViewModel.Initialize()

   at BrowserPicker.App.<OnStartup>d__2.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

   at System.Windows.Threading.DispatcherOperation.InvokeImpl()

   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Windows.Threading.DispatcherOperation.Invoke()

   at System.Windows.Threading.Dispatcher.ProcessQueue()

   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)

   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)

   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)

   at System.Windows.Application.RunDispatcher(Object ignore)

   at System.Windows.Application.RunInternal(Window window)

   at BrowserPicker.App.Main()
---------------------------
OK   
---------------------------

Downgrading to 1.7.1 restores functionality.

mortenn commented 3 years ago

How curious, it was working fine for me. must be some difference between our systems, I suppose. some kind of configuration that differs, maybe?

mortenn commented 3 years ago

Would you please test it with this debug version? Debug.zip

GravlLift commented 3 years ago

I grabbed tag v1.8.2 and started it up on my local. Lo and behold running the debug build produced the same behavior, which seems to be caused by a null name browser getting into Choices:

image

Looks like for the most part the rest of the browsers in that list come from initial configuration, but the null browser is being added by GetBrowserDetails. Looks like it's trying to add IEXPLORE.EXE (despite internet explorer already being present in Choices...?

image

mortenn commented 3 years ago

That is certainly strange. Could you please attach a dump of that registry key to the issue?

GravlLift commented 3 years ago
Key Name:          HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\IEXPLORE.EXE
Class Name:        <NO CLASS>
Last Write Time:   2020-10-22 - 5:11 PM
Value 0
  Name:            <NO NAME>
  Type:            REG_SZ
  Data:            Internet Explorer

Value 1
  Name:            LocalizedString
  Type:            REG_SZ
  Data:            @C:\Program Files\Internet Explorer\iexplore.exe,-702

Key Name:          HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\IEXPLORE.EXE\DefaultIcon
Class Name:        <NO CLASS>
Last Write Time:   2020-10-22 - 5:11 PM
Value 0
  Name:            <NO NAME>
  Type:            REG_SZ
  Data:            C:\Program Files\Internet Explorer\iexplore.exe,-9

Key Name:          HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\IEXPLORE.EXE\InstallInfo
Class Name:        <NO CLASS>
Last Write Time:   2020-10-22 - 5:17 PM
Value 0
  Name:            IconsVisible
  Type:            REG_DWORD
  Data:            0x1

Value 1
  Name:            HideIconsCommand
  Type:            REG_EXPAND_SZ
  Data:            "%Systemroot%\system32\ie4ushowIE.exe" -hide

Value 2
  Name:            ReinstallCommand
  Type:            REG_SZ
  Data:            "C:\Windows\System32\ie4uinit.exe" -reinstall

Value 3
  Name:            ShowIconsCommand
  Type:            REG_EXPAND_SZ
  Data:            "%Systemroot%\system32\ie4ushowIE.exe" -show

Value 4
  Name:            DeferMigrationCommand
  Type:            REG_SZ
  Data:            -show

Key Name:          HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\IEXPLORE.EXE\shell
Class Name:        <NO CLASS>
Last Write Time:   2019-12-07 - 5:50 AM

Key Name:          HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\IEXPLORE.EXE\shell\naom
Class Name:        <NO CLASS>
Last Write Time:   2020-10-22 - 5:11 PM
Value 0
  Name:            MUIVerb
  Type:            REG_SZ
  Data:            @C:\Windows\System32\ieframe.dll,-39229

Key Name:          HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\IEXPLORE.EXE\shell\naom\command
Class Name:        <NO CLASS>
Last Write Time:   2020-10-22 - 5:11 PM
Value 0
  Name:            <NO NAME>
  Type:            REG_SZ
  Data:            "C:\Program Files\Internet Explorer\iexplore.exe" -extoff

Key Name:          HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\IEXPLORE.EXE\shell\open
Class Name:        <NO CLASS>
Last Write Time:   2019-12-07 - 5:50 AM

Key Name:          HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\IEXPLORE.EXE\shell\open\command
Class Name:        <NO CLASS>
Last Write Time:   2020-10-22 - 5:11 PM
Value 0
  Name:            <NO NAME>
  Type:            REG_SZ
  Data:            C:\Program Files\Internet Explorer\iexplore.exe
GravlLift commented 3 years ago

Sorry, that wasn't right. That's the copy of that entry from my laptop, which handles the new version just fine.

Here's my desktop copy, and it's immediately obvious to me what the difference is: Internet Explorer has been disabled in my Windows features on my desktop machine.

Key Name:          HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\IEXPLORE.EXE
Class Name:        <NO CLASS>
Last Write Time:   2021-06-24 - 15:22

Key Name:          HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\IEXPLORE.EXE\InstallInfo
Class Name:        <NO CLASS>
Last Write Time:   2021-06-24 - 15:22
Value 0
  Name:            IconsVisible
  Type:            REG_DWORD
  Data:            0x1

Value 1
  Name:            DeferMigrationCommand
  Type:            REG_SZ
  Data:            -show
mortenn commented 3 years ago

Ah, I see.

mortenn commented 3 years ago

Hopefully this should be adressed in 1.8.3, are you able to verify, please?

GravlLift commented 3 years ago

@mortenn, yup that did it. Nicely done!