|
1 | 1 | using Microsoft.ApplicationInsights; |
2 | 2 | using Microsoft.ApplicationInsights.DataContracts; |
| 3 | +using Microsoft.ApplicationInsights.DependencyCollector; |
3 | 4 | using Microsoft.ApplicationInsights.Extensibility; |
4 | 5 | using Microsoft.Extensions.Logging; |
5 | 6 | using System.Diagnostics; |
@@ -27,6 +28,7 @@ public class ApplicationInsightsProvider : IInsightsProvider, ILogger |
27 | 28 | public bool IsTrackEventsEnabled { get; set; } = true; |
28 | 29 | public bool IsTrackDependencyEnabled { get; set; } = true; |
29 | 30 | public bool EnableConsoleLogging { get; set; } |
| 31 | + public bool UseDependencyTrackingModule { get; set; } = false; |
30 | 32 |
|
31 | 33 | private static ICrashHandler CreateDefaultCrashHandlerType() => new CrashToJsonFileStorageHandler(); |
32 | 34 |
|
@@ -76,7 +78,7 @@ public ApplicationInsightsProvider(MauiWinUIApplication app, string? connectionS |
76 | 78 | { |
77 | 79 | ConnectionString = connectionString; |
78 | 80 | provider = this; |
79 | | - |
| 81 | + |
80 | 82 | this.crashHandler = crashHandler ?? CreateDefaultCrashHandlerType(); |
81 | 83 |
|
82 | 84 | app.UnhandledException += App_UnhandledException; |
@@ -190,6 +192,13 @@ private static void OnDisappearing(object? sender, Page e) |
190 | 192 | ConnectionString = ConnectionString |
191 | 193 | }; |
192 | 194 |
|
| 195 | + |
| 196 | + if (UseDependencyTrackingModule) |
| 197 | + { |
| 198 | + var dependencyModule = new DependencyTrackingTelemetryModule(); |
| 199 | + dependencyModule.Initialize(configuration); |
| 200 | + } |
| 201 | + |
193 | 202 | client = new TelemetryClient(configuration); |
194 | 203 |
|
195 | 204 | client.Context.Device.OperatingSystem = DeviceInfo.Platform.ToString(); |
|
0 commit comments