One Time Initialization

Skip to end of metadata
Go to start of metadata

Current OneTimeInitialization Scheme

Objectives:

  • When a new build is installed, one-time-init should happen for each user.
  • When some addon is installed into the existing build (eg a plugin), one-time-init should also happen for each user.
  • One-time-init should be writing only to the user-writable Registry hives (Current User), while it might read the Local Machine hive. Installation can write to Local Machine only.

Solution:

  • Implemented by the OneTimeInitializationManager class.
  • Uses three Registry values under the product Registry keys on Machine and User hives to track the state.

The values are:

# RegHive Key Value Name Value Value | OneTimeInit Behavior R# Installation Plugins Installation
1 Local Machine Shell :: ProductRegistryKey OneTimeInitializationManager :: GenerationRegistryValueName Per-machine one-time-init generation value. Should be changed each time all the users are required to reinit over the same R# build, eg a plugin is added per-machine.   See per-user generation value for details. Set to the current time and date in any format. Per-machine-install: Set to the current time and date in any format. Per-user-install: Don't touch.
2 Current User Shell :: ProductRegistryKey OneTimeInitializationManager :: GenerationRegistryValueName Per-user one-time-init generation value. Reflects the per-machine generation by the moment one-time-init was last performed. Triggers one-time-init when the per-machine value is touched, eg by a plugin installer.   Compare the per-user and per-machine generations. Do first-time init if different. Copy the per-machine generation value to the per-user one. Don't touch. Per-machine-install: Don't touch. Per-user-install: Set to the current time and date in any format.
3 Current User Shell :: ProductRegistryKey OneTimeInitializationManager :: IdentityRegistryValueName A function of the build number and assemblies configuration. Provides for performing one-time-init automatically each time a new build is installed or internal mode is switched, regardless of the machine one-time-init keys.   On each start, the function is re-evaluated and compared to this registry value. If different, one-time-init is performed; after that, the up-to-date value is written to the Registry [1]. Don't touch (cannot touch a per-user value in a per-machine install). Don't touch.

Notes:

  • [1] — Thus, on Access Denied error one-time-init will be performed on each start.
  • Shell::ProductRegistryKey and thus the one-time-init markers depend on R# version, VS version and VS RootSuffix.

Former OneTimeInitialization Scheme

One Time Initialization is recorded by putting a build number as a value of a key registry. This key is per user, per VS registry root suffix.

For this scheme to work for VS debugging, all debug builds (builds under VS) should have the same build number. There is an action in ReSharper to invalidate the flag, also the flag is invalidated (for 8.0ReSharper hive) every time runDevWhidbey.bat is run.

'Build number' includes the value of 'ReSharper.Internal' flag.

Programmatically, there are two ways to perform OneTimeInitailiaztion. You either query a flag in OneTimeInitializationManager, or write a special component that is invoked by OneTimeInitializationManager if we do one-time initialization.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.