11
11
using Microsoft . CodeAnalysis . Razor ;
12
12
using Microsoft . CodeAnalysis . Razor . Cohost ;
13
13
using Microsoft . CodeAnalysis . Razor . Logging ;
14
+ using Microsoft . CodeAnalysis . Razor . Telemetry ;
14
15
using WorkspacesSR = Microsoft . CodeAnalysis . Razor . Workspaces . Resources . SR ;
15
16
16
17
namespace Microsoft . VisualStudio . Razor . LanguageClient . Cohost ;
@@ -19,14 +20,17 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost;
19
20
[ Export ( typeof ( IIncompatibleProjectNotifier ) ) ]
20
21
[ method: ImportingConstructor ]
21
22
internal sealed class IncompatibleProjectNotifier (
23
+ ITelemetryReporter telemetryReporter ,
22
24
ILoggerFactory loggerFactory ) : IIncompatibleProjectNotifier , IProjectCapabilityListener
23
25
{
24
26
private readonly ILogger _logger = loggerFactory . GetOrCreateLogger < IncompatibleProjectNotifier > ( ) ;
25
27
26
28
private readonly HashSet < string > _frameworkProjects = new ( PathUtilities . OSSpecificPathComparer ) ;
29
+ private readonly ITelemetryReporter _telemetryReporter = telemetryReporter ;
27
30
28
31
public void NotifyMiscFilesDocument ( TextDocument textDocument )
29
32
{
33
+ _telemetryReporter . ReportEvent ( "cohost/miscFilesDocument" , Severity . Normal ) ;
30
34
_logger . Log ( LogLevel . Error , $ "{ WorkspacesSR . FormatIncompatibleProject_MiscFiles ( Path . GetFileName ( textDocument . FilePath ) ) } ") ;
31
35
}
32
36
@@ -41,11 +45,13 @@ public void NotifyMissingDocument(Project project, string filePath)
41
45
if ( _frameworkProjects . Contains ( project . FilePath . AssumeNotNull ( ) ) )
42
46
{
43
47
// This project doesn't have the .NET Core C# capability, so it's a .NET Framework project and we don't want
48
+
44
49
// to notify the user, as those projects use a different editor.
45
50
return ;
46
51
}
47
52
}
48
53
54
+ _telemetryReporter . ReportEvent ( "cohost/missingDocument" , Severity . Normal ) ;
49
55
_logger . Log ( LogLevel . Error , $ "{ (
50
56
project . AdditionalDocuments . Any ( d => d . FilePath is not null && d . FilePath . IsRazorFilePath ( ) )
51
57
? WorkspacesSR . FormatIncompatibleProject_NotAnAdditionalFile ( Path . GetFileName ( filePath ) , project . Name )
0 commit comments