PikeNote / taskbar-groups-pike-beta

Lightweight application that lets users create and pin groups to the Windows taskbar och desktop
MIT License
135 stars 9 forks source link

2.0 Alpha unable to use shortcuts with special characters #11

Closed JohnLGalt closed 1 year ago

JohnLGalt commented 3 years ago

Background:

I have a folder on a drive that has lots of portable apps and programs in it, well over 100, each in their own subfolder. More than a few of those apps I have multiple versions of, like stable and βeta and ɒlpha releases. To differentiate them I usually make 2 folders, one with the app name and a second with the app name followed by βeta, or ɒlpha, or the like. Example:

OBS Studio OBS Studio βeta

However, any shortcut that has βeta or even ɒlpha in either the path or working directory throws an exception in TBG, and, furthermore, even if you select continue, The shortcut is not loaded into the group.

Incidentally, the same programs can be pinned to the taskbar directly and have 0 issues running, and Windows has 0 issues navigating to these folders with special characters. This also leads to the workaround I post below.

System info

OS:

Windows 10 19043.1081 and newer, and Windows 11 22000.71 and 22000.100

Software:

All .NET runtimes and VCRedist updated regularly. Windows Defender only AV used with RTS. https://github.com/ModernFlyouts-Community/ModernFlyouts used with all systems.

Steps to reproduce

  1. Run TBG 2.0 ɒlpha (from regular directory with no special characters), create group
  2. Add shortcut to program in a folder with special character

Expected Results

TBG should create the group without an error and the application should run normally from its shortcut and from teh TBG group shortcut.

Actual results:

Upon attempting to add a shortcut to TBG with a special character in the path, the following error is thrown:

05

The full log from the details pane:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at client.Classes.handleWindowsApp.findWindowsAppsFolder(String subAppName)
   at client.Classes.handleWindowsApp.getWindowsAppIcon(String file, Boolean alreadyAppID)
   at client.Forms.frmGroup.handleLnkExt(String file)
   at client.User_controls.ucProgramShortcut.ucProgramShortcut_Load(Object sender, EventArgs e)
   at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.ControlCollection.Add(Control value)
   at client.Forms.frmGroup.LoadShortcut(ProgramShortcut psc, Int32 position)
   at client.Forms.frmGroup.pnlAddShortcut_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4395.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
TaskbarGroups
    Assembly Version: 0.2.0.0
    Win32 Version: 0.2.0.0
    CodeBase: file:///E:/Programs/TaskBarGroupsAlpha%20by%20Pike/TaskbarGroupsAlphabyPike.exe
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4395.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4360.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4395.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4395.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4341.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Net.Http
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Net.Http/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Net.Http.dll
----------------------------------------
Windows.Data
    Assembly Version: 255.255.255.255
    Win32 Version: 10.0.10011.16384
    CodeBase: file:///C:/WINDOWS/system32/WinMetadata/Windows.Data.winmd
----------------------------------------
Windows.Foundation
    Assembly Version: 255.255.255.255
    Win32 Version: 10.0.10011.16384
    CodeBase: file:///C:/WINDOWS/system32/WinMetadata/Windows.Foundation.winmd
----------------------------------------
Microsoft.CSharp
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.CSharp/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll
----------------------------------------
System.Dynamic
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Dynamic/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Dynamic.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4395.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
Windows.ApplicationModel
    Assembly Version: 255.255.255.255
    Win32 Version: 10.0.10011.16384
    CodeBase: file:///C:/WINDOWS/system32/WinMetadata/Windows.ApplicationModel.winmd
----------------------------------------
Windows.Management
    Assembly Version: 255.255.255.255
    Win32 Version: 10.0.10011.16384
    CodeBase: file:///C:/WINDOWS/system32/WinMetadata/Windows.Management.winmd
----------------------------------------
System.Runtime
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.dll
----------------------------------------
Windows.Storage
    Assembly Version: 255.255.255.255
    Win32 Version: 10.0.10011.16384
    CodeBase: file:///C:/WINDOWS/system32/WinMetadata/Windows.Storage.winmd
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Workaroud:

If you don't use a shortcut to the app, but select the executable itself from the folder, no error is thrown, and the resulting shortcut created in your group works perfectly fine - even with a special character in the path, and even with a special character in the name, as well.

06

PikeNote commented 1 year ago

Fixed by 64102fb0750d5bd71c9f3ce7371df52efea9cb9e

JohnLGalt commented 1 year ago

Sweet! Thank you!