BrowseRouter
BrowseRouter copied to clipboard
App won't launch or show any error if there are missing entries in config file
Setup
New install of BrowseRouter v0.6.0 Win11 23H2
Config
I modified the config file by commenting out the ff
browser, as I don't have it installed:
[browsers]
chrome = "C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Default" --new-window
chrome_1 = "C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1" --new-window
brave = "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" --new-window
edge = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
;ff = C:\Program Files\Mozilla Firefox\firefox.exe
[urls]
*.test.com = ff
test2.test.com = chrome
*.microsoft.com = edge
[sources]
* - Notepad = ff
Slack | Test = chrome
*Microsoft Teams* = ff
*Microsoft Visual Studio* = ff
Issue
My config caused the app to not launch, but it did not return any error in GUI or CMD. Being a new install I wondered if there was some incompatibility or issue.
Troubleshooting
Attempted launch in terminal to see if there was an error there, but no luck:
./BrowseRouter.exe https://account.microsoft.com
Log
Finally found the issue in event log - apps:
The description for Event ID 0 from source Application cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
29/02/2024 12:19:22 BrowseRouter: System.Collections.Generic.KeyNotFoundException: The given key 'ff' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey )
at BrowseRouter.ConfigService.<>c__DisplayClass2_0.<GetUrlPreferences>b__4(KeyValuePair`2 kvp)
at System.Linq.Utilities.<>c__DisplayClass2_0`3.<CombineSelectors>b__0(TSource )
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 , Func`2 , Boolean& )
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 , Func`2 )
at BrowseRouter.UrlPreferenceExtensions.TryGetPreference(IEnumerable`1 prefs, String windowTitle, UrlPreference& pref)
at BrowseRouter.BrowserService.Launch(String url, String windowTitle)
The message resource is present but the message was not found in the message table
Workaround
My solution was to uncomment ff
to confirm, and it works. I'd guess I'll remove all entries pointing to ff
as I complete my config.
Suggestions
- No idea how complex will be to add a GUI error pop-up, if not, at least a command line error.
- If the missing key is not related to the current url launch: log it, ignore it, and proceed.
p.d. I love this thing, one of those "small" tools that streamline everyday tasks and remove day to day inconveniences!
Thanks for investigation, bug report, and kind words!
I will fix the exception by falling back to another browser. I'll make a log entry for it.
At the moment we don't have any GUI. I agree that would be nice. A notification tray message would be one solution. But I'd want to write it in a cross-platform way and I don't have a lot time to invest right now. For that you might like BrowserTamer. https://github.com/aloneguid/bt