Closed gmt2001 closed 2 years ago
I have additionally discovered that while this extension is enabled, I am unable to edit files at all in VS2022 while this Exception exists. If I attempt to type anything or hit paste, nothing occurs. Disabling LHM enables me to edit my files again
@gmt2001 Thanks for the report!
I just installed the new 5.0.0 version of License Header Manager into VS2022. I have previously used LHM in VS2019, however, I had completely uninstalled VS2019 before installing VS2022.
It appears that
GetRegistryKey()
returnednull
inLoadCurrentRegistryValues_3_0_3()
and therefore the logger call on the next line tries to dereferencenull.Name
, and the processing logic underneath would end up doing similar.The root cause of all this appears to be that
OptionsStoreMode.RegistryStore_3_0_3
is assumed untilOptionsStoreMode.JsonStore
is explicitly set, and thusMigrateOptions()
is triggered on the non-existent 3.0.3 registry store.I checked my
AppData\Roaming\Microsoft\VisualStudio
version folders and had no artifacts from previous versions of LHM. I also checked myHKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\
version registry keys and had no artifacts from previous versions of LHM.My project does have a .licenseheader file since I was using LHM with the project back when I was working on it in VS2019.
Here is the stacktrace from the ActivityLog.xml (I decoded the HTML entities for readability).
The proposed fix which I have submitted in this PR is to wrap everything underneath the
GetRegistryKey()
call in aif != null
check, except for the final line that setsOptionsStoreMode.JsonStore
.