/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { try { NLogService.Setup($"{nameof(VSMonoDebuggerPackage)}.log"); DebugEngineInstallService.TryRegisterAssembly(); await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); UserSettingsManager.Initialize(this); VSMonoDebuggerCommands.Initialize(this); } catch (UnauthorizedAccessException uex) { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); var package = this as Package; VsShellUtilities.ShowMessageBox( package, "Failed finish installation of VSMonoDebugger - Please run Visual Studio once as Administrator...", $"{nameof(VSMonoDebuggerPackage)} - Register mono debug engine", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); NLogService.Logger.Error(uex); } catch (Exception ex) { NLogService.Logger.Error(ex); } await base.InitializeAsync(cancellationToken, progress); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); try { NLogService.Setup($"{nameof(VSMonoDebuggerPackage)}.log"); UserSettingsManager.Initialize(this); DebugEngineInstallService.TryRegisterAssembly(); VSMonoDebuggerCommands.Initialize(this); } catch (UnauthorizedAccessException uex) { VsShellUtilities.ShowMessageBox( this, "Failed finish installation of VSMonoDebugger - Please run Visual Studio once as Administrator...", $"{nameof(VSMonoDebuggerPackage)} - Register mono debug engine", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); NLogService.Logger.Error(uex); } catch (Exception ex) { NLogService.Logger.Error(ex); } }