protected override void CompilerSpecificSqm(IVsSqmMulti sqm, uint sqmSession) { sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_COMPILERTYPE, (uint)SqmServiceProvider.CompilerType.Compiler); sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_LANGUAGEVERSION, (uint)Arguments.ParseOptions.LanguageVersion); sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNINGLEVEL, (uint)Arguments.CompilationOptions.WarningLevel); //Project complexity # of source files, # of references sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_SOURCES, (uint)Arguments.SourceFiles.Count()); sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_REFERENCES, (uint)Arguments.ReferencePaths.Count()); }
protected override void CompilerSpecificSqm(IVsSqmMulti sqm, uint sqmSession) { sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_COMPILERTYPE, (uint)SqmServiceProvider.CompilerType.CompilerServer); sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_LANGUAGEVERSION, (uint)Arguments.ParseOptions.LanguageVersion); sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNINGLEVEL, (uint)Arguments.CompilationOptions.WarningLevel); //Project complexity # of source files, # of references sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_SOURCES, (uint)Arguments.SourceFiles.Count()); sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_REFERENCES, (uint)Arguments.ReferencePaths.Count()); }
private static void LogNumericBuildNumber(IVsSqmMulti session, uint sessionHandle, uint datapoint, string build) { uint numericBuild = 0; uint.TryParse(build.Split('.').Join(""), out numericBuild); session.SetDatapoint(sessionHandle, datapoint, numericBuild); }
protected override void CompilerSpecificSqm(IVsSqmMulti sqm, uint sqmSession) { sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_COMPILERTYPE, (uint)SqmServiceProvider.CompilerType.CompilerServer); sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNINGLEVEL, (uint)Arguments.CompilationOptions.WarningLevel); sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_LANGUAGEVERSION, (uint)Arguments.ParseOptions.LanguageVersion); sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNINGLEVEL, Arguments.CompilationOptions.GeneralDiagnosticOption == ReportDiagnostic.Suppress ? 1u : 0u); sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_EMBEDVBCORE, Arguments.CompilationOptions.EmbedVbCoreRuntime ? 1u : 0u); //Project complexity # of source files, # of references sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_SOURCES, (uint)Arguments.SourceFiles.Count()); sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_REFERENCES, (uint)Arguments.ReferencePaths.Count()); }
private void GenerateSqmData(CompilationOptions compilationOptions, ImmutableArray <Diagnostic> diagnostics) { // Generate SQM data file for Compilers if (Arguments.SqmSessionGuid != Guid.Empty) { IVsSqmMulti sqm = null; uint sqmSession = 0u; try { sqm = SqmServiceProvider.TryGetSqmService(_clientDirectory); if (sqm != null) { sqm.BeginSession(this.GetSqmAppID(), false, out sqmSession); sqm.SetGlobalSessionGuid(Arguments.SqmSessionGuid); // Build Version sqm.SetStringDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_BUILDVERSION, GetAssemblyFileVersion()); // Write Errors and Warnings from build foreach (var diagnostic in diagnostics) { switch (diagnostic.Severity) { case DiagnosticSeverity.Error: sqm.AddItemToStream(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_ERRORNUMBERS, (uint)diagnostic.Code); break; case DiagnosticSeverity.Warning: sqm.AddItemToStream(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNINGNUMBERS, (uint)diagnostic.Code); break; case DiagnosticSeverity.Hidden: case DiagnosticSeverity.Info: break; default: throw ExceptionUtilities.UnexpectedValue(diagnostic.Severity); } } //Suppress Warnings / warningCode as error / warningCode as warning foreach (var item in compilationOptions.SpecificDiagnosticOptions) { uint code; if (TryGetCompilerDiagnosticCode(item.Key, out code)) { ReportDiagnostic options = item.Value; switch (options) { case ReportDiagnostic.Suppress: sqm.AddItemToStream(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_SUPPRESSWARNINGNUMBERS, code); // Suppress warning break; case ReportDiagnostic.Error: sqm.AddItemToStream(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNASERRORS_NUMBERS, code); // Warning as errors break; case ReportDiagnostic.Warn: sqm.AddItemToStream(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNASWARNINGS_NUMBERS, code); // Warning as warnings break; default: break; } } } sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_OUTPUTKIND, (uint)compilationOptions.OutputKind); CompilerSpecificSqm(sqm, sqmSession); } } finally { if (sqm != null) { sqm.EndSession(sqmSession); } } } }
protected override void CompilerSpecificSqm(IVsSqmMulti sqm, uint sqmSession) { sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_COMPILERTYPE, (uint)SqmServiceProvider.CompilerType.Interactive); }
private void GenerateSqmData(CompilationOptions compilationOptions, ImmutableArray <Diagnostic> diagnostics) { // Generate SQM data file for Compilers if (Arguments.SqmSessionGuid != Guid.Empty) { IVsSqmMulti sqm = null; uint sqmSession = 0u; try { sqm = SqmServiceProvider.TryGetSqmService(); if (sqm != null) { sqm.BeginSession(this.GetSqmAppID(), false, out sqmSession); #if !BOOTSTRAP sqm.SetGlobalSessionGuid(Arguments.SqmSessionGuid); #endif // Build Version Assembly thisAssembly = typeof(CommonCompiler).Assembly; var fileVersion = FileVersionInfo.GetVersionInfo(thisAssembly.Location).FileVersion; sqm.SetStringDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_BUILDVERSION, fileVersion); // Write Errors and Warnings from build foreach (var diagnostic in diagnostics) { switch (diagnostic.Severity) { case DiagnosticSeverity.Error: sqm.AddItemToStream(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_ERRORNUMBERS, (uint)diagnostic.Code); break; case DiagnosticSeverity.Warning: if (diagnostic.IsWarningAsError) { sqm.AddItemToStream(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_ERRORNUMBERS, (uint)diagnostic.Code); } else { sqm.AddItemToStream(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNINGNUMBERS, (uint)diagnostic.Code); } break; case DiagnosticSeverity.None: case DiagnosticSeverity.Info: break; default: throw ExceptionUtilities.UnexpectedValue(diagnostic.Severity); } } //Suppress Warnings / warningCode as error / warningCode as warning foreach (var item in compilationOptions.SpecificDiagnosticOptions) { uint code = uint.Parse(item.Key.Substring(2)); ReportDiagnostic options = item.Value; switch (options) { case ReportDiagnostic.Suppress: sqm.AddItemToStream(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_SUPPRESSWARNINGNUMBERS, code); // Supress warning break; case ReportDiagnostic.Error: sqm.AddItemToStream(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNASERRORS_NUMBERS, code); // Warning as errors break; case ReportDiagnostic.Warn: sqm.AddItemToStream(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNASWARNINGS_NUMBERS, code); // Warning as warnings break; default: break; } } sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_OUTPUTKIND, (uint)compilationOptions.OutputKind); CompilerSpecificSqm(sqm, sqmSession); } } finally { if (sqm != null) { sqm.EndSession(sqmSession); } } } }