@@ -47,7 +47,11 @@ import { getComponentFolder } from './lsptoolshost/extensions/builtInComponents'
4747export async function activate (
4848 context : vscode . ExtensionContext
4949) : Promise < CSharpExtensionExports | OmnisharpExtensionExports | null > {
50+ // Start measuring the activation time
51+ const startActivation = process . hrtime ( ) ;
52+
5053 const csharpChannel = vscode . window . createOutputChannel ( 'C#' , { log : true } ) ;
54+ csharpChannel . trace ( 'Activating C# Extension' ) ;
5155
5256 await MigrateOptions ( vscode ) ;
5357 const optionStream = createOptionStream ( vscode ) ;
@@ -120,6 +124,7 @@ export async function activate(
120124 const useFramework = useOmnisharpServer && omnisharpOptions . useModernNet !== true ;
121125 const installDependencies : IInstallDependencies = async ( dependencies : AbsolutePathPackage [ ] ) =>
122126 downloadAndInstallPackages ( dependencies , networkSettingsProvider , eventStream , isValidDownload ) ;
127+
123128 const runtimeDependenciesExist = await ensureRuntimeDependencies (
124129 context . extension ,
125130 eventStream ,
@@ -247,10 +252,7 @@ export async function activate(
247252 ) ;
248253 }
249254
250- const activationProperties : { [ key : string ] : string } = {
251- serverKind : useOmnisharpServer ? 'OmniSharp' : 'Roslyn' ,
252- } ;
253- reporter . sendTelemetryEvent ( TelemetryEventNames . CSharpActivated , activationProperties ) ;
255+ let exports : CSharpExtensionExports | OmnisharpExtensionExports ;
254256
255257 if ( ! useOmnisharpServer ) {
256258 debugSessionTracker . initializeDebugSessionHandlers ( context ) ;
@@ -262,7 +264,7 @@ export async function activate(
262264 util . isNotNull ( projectInitializationCompletePromise ) ;
263265
264266 const languageServerExport = new RoslynLanguageServerExport ( roslynLanguageServerStartedPromise ) ;
265- return {
267+ exports = {
266268 initializationFinished : async ( ) => {
267269 await coreClrDebugPromise ;
268270 await razorLanguageServerStartedPromise ;
@@ -282,7 +284,7 @@ export async function activate(
282284 } ,
283285 } ;
284286 } else {
285- return {
287+ exports = {
286288 initializationFinished : async ( ) => {
287289 const langService = await omnisharpLangServicePromise ;
288290 await langService ! . server . waitForInitialize ( ) ;
@@ -304,6 +306,17 @@ export async function activate(
304306 logDirectory : context . logUri . fsPath ,
305307 } ;
306308 }
309+
310+ const timeTaken = process . hrtime ( startActivation ) ;
311+ const timeTakenStr = ( timeTaken [ 0 ] * 1000 + timeTaken [ 1 ] / 1000000 ) . toFixed ( 3 ) ;
312+ csharpChannel . trace ( 'C# Extension activated in ' + timeTakenStr + 'ms.' ) ;
313+ const activationProperties : { [ key : string ] : string } = {
314+ serverKind : useOmnisharpServer ? 'OmniSharp' : 'Roslyn' ,
315+ timeTaken : timeTakenStr ,
316+ } ;
317+ reporter . sendTelemetryEvent ( TelemetryEventNames . CSharpActivated , activationProperties ) ;
318+
319+ return exports ;
307320}
308321
309322/**
0 commit comments