src/vs/platform/extensionManagement/common/extensionsProfileScannerService.ts/ExtensionsProfileScannerService/withProfileExtensions
class ExtensionsProfileScannerService:	private async withProfileExtensions(file: URI, updateFn?: (extensions: IScannedProfileExtension[]) => IScannedProfileExtension[]): Promise<IScannedProfileExtension[]> {
		return this.getResourceAccessQueue(file).queue(async () => {
			let extensions: IScannedProfileExtension[] = [];

			// Read
			let storedWebExtensions: IStoredProfileExtension[] | undefined;
			try {
				const content = await this.fileService.readFile(file);
				storedWebExtensions = <IStoredProfileExtension[]>JSON.parse(content.value.toString());
			} catch (error) {
				if (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {
					throw error;
				}
				// migrate from old location, remove this after couple of releases
				if (this.uriIdentityService.extUri.isEqual(file, this.userDataProfilesService.defaultProfile.extensionsResource)) {
					storedWebExtensions = await this.migrateFromOldDefaultProfileExtensionsLocation();
				}
			}
			if (storedWebExtensions) {
				for (const e of storedWebExtensions) {
					if (!e.identifier) {
						this.logService.info('Ignoring invalid extension while scanning. Identifier does not exist.', e);
						continue;
					}
					if (!e.location) {
						this.logService.info('Ignoring invalid extension while scanning. Location does not exist.', e);
						continue;
					}
					if (!e.version) {
						this.logService.info('Ignoring invalid extension while scanning. Version does not exist.', e);
						continue;
					}
					extensions.push({
						identifier: e.identifier,
						location: URI.revive(e.location),
						version: e.version,
						metadata: e.metadata,
					});
				}
			}

			// Update
			if (updateFn) {
				extensions = updateFn(extensions);
				const storedProfileExtensions: IStoredProfileExtension[] = extensions.map(e => ({
					identifier: e.identifier,
					version: e.version,
					location: e.location.toJSON(),
					metadata: e.metadata
				}));
				await this.fileService.writeFile(file, VSBuffer.fromString(JSON.stringify(storedProfileExtensions)));
			}

			return extensions;
		});
	}