diff --git a/src/CodingWithCalvin.OpenBinFolder/CodingWithCalvin.OpenBinFolder.csproj b/src/CodingWithCalvin.OpenBinFolder/CodingWithCalvin.OpenBinFolder.csproj
index 8fac116..ad1664e 100644
--- a/src/CodingWithCalvin.OpenBinFolder/CodingWithCalvin.OpenBinFolder.csproj
+++ b/src/CodingWithCalvin.OpenBinFolder/CodingWithCalvin.OpenBinFolder.csproj
@@ -8,11 +8,8 @@
bin/$(Configuration)/
-
- True
-
-
+
diff --git a/src/CodingWithCalvin.OpenBinFolder/Commands/OpenBinFolderCommand.cs b/src/CodingWithCalvin.OpenBinFolder/Commands/OpenBinFolderCommand.cs
index 0779eb6..f0807f0 100644
--- a/src/CodingWithCalvin.OpenBinFolder/Commands/OpenBinFolderCommand.cs
+++ b/src/CodingWithCalvin.OpenBinFolder/Commands/OpenBinFolderCommand.cs
@@ -1,7 +1,9 @@
-using System;
+using System;
+using System.Collections.Generic;
using System.ComponentModel.Design;
using System.IO;
using System.Windows.Forms;
+using CodingWithCalvin.Otel4Vsix;
using EnvDTE;
using EnvDTE80;
using Microsoft.VisualStudio.Shell;
@@ -44,39 +46,48 @@ private void OpenPath(object sender, EventArgs e)
{
ThreadHelper.ThrowIfNotOnUIThread();
- if (!(ServiceProvider.GetService(typeof(DTE)) is DTE2 dte))
- {
- throw new ArgumentNullException(nameof(dte));
- }
+ using var activity = VsixTelemetry.StartCommandActivity("OpenBinFolder.OpenPath");
- foreach (
- UIHierarchyItem selectedItem in (Array)
- dte.ToolWindows.SolutionExplorer.SelectedItems
- )
+ try
{
- switch (selectedItem.Object)
+ if (!(ServiceProvider.GetService(typeof(DTE)) is DTE2 dte))
+ {
+ throw new ArgumentNullException(nameof(dte));
+ }
+
+ foreach (
+ UIHierarchyItem selectedItem in (Array)
+ dte.ToolWindows.SolutionExplorer.SelectedItems
+ )
{
- case Project project:
- try
- {
+ switch (selectedItem.Object)
+ {
+ case Project project:
OpenProjectBinFolder(project);
- }
- catch (Exception ex)
- {
- MessageBox.Show(
- $@"
- Unable to determine output path for selected project
- {Environment.NewLine}
- {Environment.NewLine}
- Exception: {ex.Message}"
- );
- }
-
- break;
+ break;
+ }
}
+
+ VsixTelemetry.LogInformation("Bin folder opened successfully");
}
+ catch (Exception ex)
+ {
+ activity?.RecordError(ex);
+ VsixTelemetry.TrackException(ex, new Dictionary
+ {
+ { "operation.name", "OpenPath" }
+ });
+ throw;
+ }
+ }
- void OpenProjectBinFolder(Project project)
+ private void OpenProjectBinFolder(Project project)
+ {
+ ThreadHelper.ThrowIfNotOnUIThread();
+
+ using var activity = VsixTelemetry.StartCommandActivity("OpenBinFolder.OpenProjectBinFolder");
+
+ try
{
var projectPath =
Path.GetDirectoryName(project.FullName)
@@ -88,9 +99,27 @@ void OpenProjectBinFolder(Project project)
var projectBinPath = Path.Combine(projectPath, projectOutputPath);
- System.Diagnostics.Process.Start(
+ System.Diagnostics.Process.Start(
Directory.Exists(projectBinPath) ? projectBinPath : projectPath
);
+
+ VsixTelemetry.LogInformation("Opened bin folder for project");
+ }
+ catch (Exception ex)
+ {
+ activity?.RecordError(ex);
+ VsixTelemetry.TrackException(ex, new Dictionary
+ {
+ { "operation.name", "OpenProjectBinFolder" },
+ });
+
+ MessageBox.Show(
+ $@"
+ Unable to determine output path for selected project
+ {Environment.NewLine}
+ {Environment.NewLine}
+ Exception: {ex.Message}"
+ );
}
}
}
diff --git a/src/CodingWithCalvin.OpenBinFolder/HoneycombConfig.cs b/src/CodingWithCalvin.OpenBinFolder/HoneycombConfig.cs
new file mode 100644
index 0000000..3271e46
--- /dev/null
+++ b/src/CodingWithCalvin.OpenBinFolder/HoneycombConfig.cs
@@ -0,0 +1,7 @@
+namespace CodingWithCalvin.OpenBinFolder
+{
+ internal static class HoneycombConfig
+ {
+ public const string ApiKey = "PLACEHOLDER";
+ }
+}
diff --git a/src/CodingWithCalvin.OpenBinFolder/OpenBinFolderPackage.cs b/src/CodingWithCalvin.OpenBinFolder/OpenBinFolderPackage.cs
index dfb6e59..3504c88 100644
--- a/src/CodingWithCalvin.OpenBinFolder/OpenBinFolderPackage.cs
+++ b/src/CodingWithCalvin.OpenBinFolder/OpenBinFolderPackage.cs
@@ -1,7 +1,8 @@
-using System;
+using System;
using System.Runtime.InteropServices;
using System.Threading;
using CodingWithCalvin.OpenBinFolder.Commands;
+using CodingWithCalvin.Otel4Vsix;
using Microsoft.VisualStudio.Shell;
using Task = System.Threading.Tasks.Task;
@@ -20,7 +21,31 @@ IProgress progress
{
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
+ var builder = VsixTelemetry.Configure()
+ .WithServiceName(VsixInfo.DisplayName)
+ .WithServiceVersion(VsixInfo.Version)
+ .WithVisualStudioAttributes(this)
+ .WithEnvironmentAttributes();
+
+#if !DEBUG
+ builder
+ .WithOtlpHttp("https://api.honeycomb.io")
+ .WithHeader("x-honeycomb-team", HoneycombConfig.ApiKey);
+#endif
+
+ builder.Initialize();
+
OpenBinFolderCommand.Initialize(this);
}
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ VsixTelemetry.Shutdown();
+ }
+
+ base.Dispose(disposing);
+ }
}
}