diff --git a/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs b/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs index 0ef7ba9207a696c25d14f30d1ddd1d08424826ae..f1dea94b58e40f59e4a0abfff9485cbc4f9fe3c4 100644 --- a/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs +++ b/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs @@ -111,7 +111,6 @@ public new CSharpCommandLineArguments Parse(IEnumerable args, string bas bool reportAnalyzer = false; CultureInfo preferredUILang = null; string touchedFilesPath = null; - var sqmSessionGuid = Guid.Empty; bool optionsEnded = false; bool interactiveMode = false; bool publicSign = false; @@ -305,12 +304,15 @@ public new CSharpCommandLineArguments Parse(IEnumerable args, string bas continue; case "sqmsessionguid": + // The use of SQM is deprecated in the compiler but we still support the parsing of the option for + // back compat reasons. if (value == null) { AddDiagnostic(diagnostics, ErrorCode.ERR_MissingGuidForOption, "", name); } else { + Guid sqmSessionGuid; if (!Guid.TryParse(value, out sqmSessionGuid)) { AddDiagnostic(diagnostics, ErrorCode.ERR_InvalidFormatForGuidForOption, value, name); @@ -1228,7 +1230,6 @@ public new CSharpCommandLineArguments Parse(IEnumerable args, string bas PrintFullPaths = printFullPaths, ShouldIncludeErrorEndLocation = errorEndLocation, PreferredUILang = preferredUILang, - SqmSessionGuid = sqmSessionGuid, ReportAnalyzer = reportAnalyzer }; } diff --git a/src/Compilers/CSharp/Portable/Utilities/IVsSQM.cs b/src/Compilers/CSharp/Portable/Utilities/IVsSQM.cs deleted file mode 100644 index 16c4d83180e61781056eb00c54baa30ea7af9112..0000000000000000000000000000000000000000 --- a/src/Compilers/CSharp/Portable/Utilities/IVsSQM.cs +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -/////////////////////////////////////////////////////////////////////////////// -// -// IVsSqm.cs : Interop definitions for interfaces defined in VsLog.idl -// -/////////////////////////////////////////////////////////////////////////////// -#pragma warning disable 3001 - -namespace Microsoft.VisualStudio.Shell.Interop -{ - using System; - using System.Runtime.InteropServices; - - [ComImport()] - [ComVisible(false)] - [Guid("C1F63D0C-4CAE-4907-BE74-EEB75D386ECB")] - [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] - internal interface IVsSqm - { - void GetSessionStartTime( - [Out] out System.Runtime.InteropServices.ComTypes.FILETIME time - ); - void GetFlags( - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 flags - ); - void SetFlags( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 flags - ); - void ClearFlags( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 flags - ); - void AddItemToStream( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void SetDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - // OBSOLETE IN SQMAPI.DLL. DO NOT CALL. - void GetDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 value - ); - void EnterTaggedAssert( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dwTag, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dwPossibleBuild, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dwActualBuild - ); - void RecordCmdData( - [In] ref Guid pguidCmdGroup, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void GetHashOfGuid( - [In] ref Guid hashGuid, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 resultantHash - ); - void GetHashOfString( - [In, MarshalAs(UnmanagedType.BStr)] string hashString, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 resultantHash - ); - void IncrementDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - - void SetDatapointBits( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - - void SetDatapointIfMax( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void SetDatapointIfMin( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void AddToDatapointAverage( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void StartDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void RecordDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AccumulateDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AddTimerToDatapointAverage( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AddArrayToStream( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4, SizeParamIndex = 2)] System.UInt32[] data, - [In, MarshalAs(UnmanagedType.I4)] int count - ); - } - - [ComImport()] - [ComVisible(false)] - [Guid("BE5F55EB-F02D-4217-BCB6-A290800AF6C4")] - [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] - internal interface IVsSqm2 - { - void SetBoolDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 fValue - ); - - void SetStringDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.BStr)] string strValue - ); - - void AddToStreamDWord( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 cTuple, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - - void AddToStreamString( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 cTuple, - [In, MarshalAs(UnmanagedType.BStr)] string strValue - ); - - void GetObfuscatedString( - [In, MarshalAs(UnmanagedType.BStr)] string input, - [Out, MarshalAs(UnmanagedType.BStr)] out string output - ); - } - - [ComImport()] - [ComVisible(false)] - [Guid("B17A7D4A-C1A3-45A2-B916-826C3ABA067E")] - [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] - internal interface IVsSqmMulti - { - [return: MarshalAs(UnmanagedType.VariantBool)] - bool GetOptInStatus(); - void UnloadSessions( - ); - void EndAllSessionsAndAbortUploads( - ); - void BeginSession( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionType, - [In, MarshalAs(UnmanagedType.VariantBool)] System.Boolean alwaysSend, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 sessionHandle - ); - void EndSession( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle - ); - void RegisterSessionHandle( - [In] ref Guid sessionIdentifier, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dwSessionHandle - ); - [return: MarshalAs(UnmanagedType.U4)] - int GetSessionHandleByIdentifier( - [In] ref Guid sessionIdentifier - ); - void GetSessionStartTime( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [Out] out System.Runtime.InteropServices.ComTypes.FILETIME time - ); - Guid GetGlobalSessionGuid(); - [return: MarshalAs(UnmanagedType.U4)] - int GetGlobalSessionHandle(); - void SetGlobalSessionGuid( - [In] ref Guid pguidSessionGuid - ); - void GetFlags( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 flags - ); - void SetFlags( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 flags - ); - void ClearFlags( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 flags - ); - void SetDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void SetBoolDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 fValue - ); - void SetStringDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.BStr)] string strValue - ); - void SetDatapointBits( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void IncrementDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - - void SetDatapointIfMax( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void SetDatapointIfMin( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void AddToDatapointAverage( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void StartDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void RecordDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AccumulateDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AddTimerToDatapointAverage( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AddItemToStream( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void AddArrayToStream( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4, SizeParamIndex = 2)] System.UInt32[] data, - [In, MarshalAs(UnmanagedType.I4)] int count - ); - void AddToStreamDWord( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 cTuple, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void AddToStreamString( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 cTuple, - [In, MarshalAs(UnmanagedType.BStr)] string strValue - ); - void RecordCmdData( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In] ref Guid pguidCmdGroup, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void GetHashOfGuid( - [In] ref Guid hashGuid, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 resultantHash - ); - void GetHashOfString( - [In, MarshalAs(UnmanagedType.BStr)] string hashString, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 resultantHash - ); - void SetProperty( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 propid, - [In] ref Guid varKey, - [In] object varValue - ); - void Get64BitHashOfString( - [In, MarshalAs(UnmanagedType.BStr)] string hashString, - [Out, MarshalAs(UnmanagedType.U8)] out System.UInt64 resultantHash - ); - } - - [ComImport()] - [ComVisible(false)] - [Guid("16be4288-950b-4265-b0dc-280b89ca9979")] - [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] - internal interface IVsSqmOptinManager - { - void GetOptinStatus( - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 optinStatus, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 preferences - ); - - void SetOptinStatus( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 optinStatus - ); - } - - [ComImport()] - [ComVisible(false)] - [Guid("2508FDF0-EF80-4366-878E-C9F024B8D981")] - internal interface SVsLog - { - } - -} diff --git a/src/Compilers/CSharp/Portable/Utilities/SqmServiceProvider.cs b/src/Compilers/CSharp/Portable/Utilities/SqmServiceProvider.cs deleted file mode 100644 index 149a4f1cb1f4b07efc56bb1970b0c70750631ea2..0000000000000000000000000000000000000000 --- a/src/Compilers/CSharp/Portable/Utilities/SqmServiceProvider.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.VisualStudio.Shell.Interop; -using System.Runtime.InteropServices; -using System.Diagnostics; - -namespace Microsoft.VisualStudio.Shell.Interop -{ - internal static class SqmServiceProvider - { - public enum CompilerType - { - Compiler = 0, - CompilerServer = 1, - Interactive = 2 - } - - // SQM Constants ----- these are NOT FINAL --- real ones will be assigned when approved by VS telemetry team - public const uint CSHARP_APPID = 50u; - public const uint BASIC_APPID = 51u; - - public const uint DATAID_SQM_ROSLYN_COMPILERTYPE = 1354u; // 0=Compiler, 1= CompilerServer, 2=Interactive - public const uint DATAID_SQM_BUILDVERSION = 1353u; // Roslyn Build Version - public const uint DATAID_SQM_ROSLYN_SOURCES = 1360u; // No of source code files this compile - public const uint DATAID_SQM_ROSLYN_REFERENCES = 1359u; // No of referenced assemblies this compile - public const uint DATAID_SQM_ROSLYN_ERRORNUMBERS = 1356u; // List of errors [and warnings as errors] - public const uint DATAID_SQM_ROSLYN_WARNINGNUMBERS = 1366u; // List of warnings [excluding wanings as errors] - public const uint DATAID_SQM_ROSLYN_WARNINGLEVEL = 1365u; // -warn:n 0 - 4 - public const uint DATAID_SQM_ROSLYN_WARNINGASERRORS = 1364u; // -warnaserror[+/-] - public const uint DATAID_SQM_ROSLYN_SUPPRESSWARNINGNUMBERS = 1361u; // -nowarn:blah;blah;blah - public const uint DATAID_SQM_ROSLYN_WARNASERRORS_NUMBERS = 1362u; // -warnaserror+:blah;blah;blah - public const uint DATAID_SQM_ROSLYN_WARNASWARNINGS_NUMBERS = 1363u; // -warnaserror-:blah;blah;blah - public const uint DATAID_SQM_ROSLYN_OUTPUTKIND = 1358u; // /target:exe|winexe ... [ConsoleApplication = 0, WindowsApplication = 1, DynamicallyLinkedLibrary = 2, NetModule = 3, WindowsRuntimeMetadata = 4] - public const uint DATAID_SQM_ROSLYN_LANGUAGEVERSION = 1357u; - public const uint DATAID_SQM_ROSLYN_EMBEDVBCORE = 1355u; - - [DllImport("vssqmmulti.dll", SetLastError = true)] - private static extern void QueryService(ref Guid rsid, ref Guid riid, out IVsSqmMulti vssqm); - - public static IVsSqmMulti TryGetSqmService() - { - IVsSqmMulti result = null; - Guid rsid = new Guid("2508FDF0-EF80-4366-878E-C9F024B8D981"); - Guid riid = new Guid("B17A7D4A-C1A3-45A2-B916-826C3ABA067E"); - try - { - QueryService(ref rsid, ref riid, out result); - } - catch (Exception e) - { - Debug.Assert(false, string.Format("Could not get SQM service or have SQM related errors: {0}", e.ToString())); - return null; - } - return result; - } - } -} diff --git a/src/Compilers/Core/Portable/CodeAnalysis.csproj b/src/Compilers/Core/Portable/CodeAnalysis.csproj index afeaa304cf2e481ce997e8b9abd49169c6454f52..1f5e4570e056cc5369075e51b98e7ef39995f6c1 100644 --- a/src/Compilers/Core/Portable/CodeAnalysis.csproj +++ b/src/Compilers/Core/Portable/CodeAnalysis.csproj @@ -407,7 +407,6 @@ - @@ -463,7 +462,6 @@ - diff --git a/src/Compilers/Core/Portable/CommandLine/CommonCommandLineArguments.cs b/src/Compilers/Core/Portable/CommandLine/CommonCommandLineArguments.cs index 6cc7849b9b0c12db889d0ff2c816a3aa42627525..d950237bd26c3527c99d237ba060b01a0a9ca1e3 100644 --- a/src/Compilers/Core/Portable/CommandLine/CommonCommandLineArguments.cs +++ b/src/Compilers/Core/Portable/CommandLine/CommonCommandLineArguments.cs @@ -246,8 +246,6 @@ public CompilationOptions CompilationOptions /// public CultureInfo PreferredUILang { get; internal set; } - internal Guid SqmSessionGuid { get; set; } - internal CommandLineArguments() { } diff --git a/src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs b/src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs index ea3d322ced583df31554c028a52b02ea855742df..59d3c0a269036ae1a985a1c939473cc1d8e6d041 100644 --- a/src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs +++ b/src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs @@ -12,7 +12,6 @@ using System.Threading; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Shell.Interop; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis @@ -38,9 +37,7 @@ internal abstract partial class CommonCompiler public abstract void PrintHelp(TextWriter consoleOutput); internal abstract string GetToolName(); - protected abstract uint GetSqmAppID(); protected abstract bool TryGetCompilerDiagnosticCode(string diagnosticId, out uint code); - protected abstract void CompilerSpecificSqm(IVsSqmMulti sqm, uint sqmSession); protected abstract ImmutableArray ResolveAnalyzersFromArguments( List diagnostics, CommonMessageProvider messageProvider); @@ -541,8 +538,6 @@ internal int RunCore(TextWriter consoleOutput, ErrorLogger errorLogger, Cancella } var compileAndEmitDiagnostics = diagnosticBag.ToReadOnly(); - GenerateSqmData(Arguments.CompilationOptions, compileAndEmitDiagnostics); - if (ReportErrors(compileAndEmitDiagnostics, consoleOutput, errorLogger)) { return Failed; @@ -711,86 +706,6 @@ private static void ReportAnalyzerExecutionTime(TextWriter consoleOutput, Analyz } } - private void GenerateSqmData(CompilationOptions compilationOptions, ImmutableArray 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); - } - } - } - } - /// /// Given a compilation and a destination directory, determine three names: /// 1) The name with which the assembly should be output (default = null, which indicates that the compilation output name should be used). diff --git a/src/Compilers/Core/Portable/Interop/IVsSQM.cs b/src/Compilers/Core/Portable/Interop/IVsSQM.cs deleted file mode 100644 index 74bcae8be5a065fb281fd48ee728cdc2dcb3ddcc..0000000000000000000000000000000000000000 --- a/src/Compilers/Core/Portable/Interop/IVsSQM.cs +++ /dev/null @@ -1,319 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -/////////////////////////////////////////////////////////////////////////////// -// -// -/////////////////////////////////////////////////////////////////////////////// - -#pragma warning disable 3001 - -using System; -using System.Runtime.InteropServices; - -namespace Microsoft.VisualStudio.Shell.Interop -{ - [ComImport()] - [ComVisible(false)] - [Guid("C1F63D0C-4CAE-4907-BE74-EEB75D386ECB")] - [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] - internal interface IVsSqm - { - void GetSessionStartTime( - [Out] out System.Runtime.InteropServices.ComTypes.FILETIME time - ); - void GetFlags( - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 flags - ); - void SetFlags( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 flags - ); - void ClearFlags( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 flags - ); - void AddItemToStream( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void SetDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - // OBSOLETE IN SQMAPI.DLL. DO NOT CALL. - void GetDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 value - ); - void EnterTaggedAssert( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dwTag, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dwPossibleBuild, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dwActualBuild - ); - void RecordCmdData( - [In] ref Guid pguidCmdGroup, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void GetHashOfGuid( - [In] ref Guid hashGuid, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 resultantHash - ); - void GetHashOfString( - [In, MarshalAs(UnmanagedType.BStr)] string hashString, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 resultantHash - ); - void IncrementDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - - void SetDatapointBits( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - - void SetDatapointIfMax( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void SetDatapointIfMin( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void AddToDatapointAverage( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void StartDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void RecordDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AccumulateDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AddTimerToDatapointAverage( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AddArrayToStream( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4, SizeParamIndex = 2)] System.UInt32[] data, - [In, MarshalAs(UnmanagedType.I4)] int count - ); - } - - [ComImport()] - [ComVisible(false)] - [Guid("BE5F55EB-F02D-4217-BCB6-A290800AF6C4")] - [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] - internal interface IVsSqm2 - { - void SetBoolDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 fValue - ); - - void SetStringDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.BStr)] string strValue - ); - - void AddToStreamDWord( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 cTuple, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - - void AddToStreamString( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 cTuple, - [In, MarshalAs(UnmanagedType.BStr)] string strValue - ); - - void GetObfuscatedString( - [In, MarshalAs(UnmanagedType.BStr)] string input, - [Out, MarshalAs(UnmanagedType.BStr)] out string output - ); - } - - [ComImport()] - [ComVisible(false)] - [Guid("B17A7D4A-C1A3-45A2-B916-826C3ABA067E")] - [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] - internal interface IVsSqmMulti - { - [return: MarshalAs(UnmanagedType.VariantBool)] - bool GetOptInStatus(); - - void UnloadSessions( - ); - void EndAllSessionsAndAbortUploads( - ); - - void BeginSession( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionType, - [In, MarshalAs(UnmanagedType.VariantBool)] System.Boolean alwaysSend, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 sessionHandle - ); - - void EndSession( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle - ); - void RegisterSessionHandle( - [In] ref Guid sessionIdentifier, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dwSessionHandle - ); - [return: MarshalAs(UnmanagedType.U4)] - int GetSessionHandleByIdentifier( - [In] ref Guid sessionIdentifier - ); - void GetSessionStartTime( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [Out] out System.Runtime.InteropServices.ComTypes.FILETIME time - ); - Guid GetGlobalSessionGuid(); - [return: MarshalAs(UnmanagedType.U4)] - int GetGlobalSessionHandle(); - void SetGlobalSessionGuid( - [In] ref Guid pguidSessionGuid - ); - void GetFlags( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 flags - ); - void SetFlags( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 flags - ); - void ClearFlags( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 flags - ); - void SetDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void SetBoolDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 fValue - ); - void SetStringDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.BStr)] string strValue - ); - void SetDatapointBits( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void IncrementDatapoint( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - - void SetDatapointIfMax( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void SetDatapointIfMin( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void AddToDatapointAverage( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void StartDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void RecordDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AccumulateDatapointTimer( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AddTimerToDatapointAverage( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID - ); - void AddItemToStream( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void AddArrayToStream( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4, SizeParamIndex = 2)] System.UInt32[] data, - [In, MarshalAs(UnmanagedType.I4)] int count - ); - void AddToStreamDWord( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 cTuple, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void AddToStreamString( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 cTuple, - [In, MarshalAs(UnmanagedType.BStr)] string strValue - ); - void RecordCmdData( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 sessionHandle, - [In] ref Guid pguidCmdGroup, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 dataPointID, - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 value - ); - void GetHashOfGuid( - [In] ref Guid hashGuid, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 resultantHash - ); - void GetHashOfString( - [In, MarshalAs(UnmanagedType.BStr)] string hashString, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 resultantHash - ); - void SetProperty( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 propid, - [In] ref Guid varKey, - [In] object varValue - ); - void Get64BitHashOfString( - [In, MarshalAs(UnmanagedType.BStr)] string hashString, - [Out, MarshalAs(UnmanagedType.U8)] out System.UInt64 resultantHash - ); - } - - [ComImport()] - [ComVisible(false)] - [Guid("16be4288-950b-4265-b0dc-280b89ca9979")] - [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] - internal interface IVsSqmOptinManager - { - void GetOptinStatus( - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 optinStatus, - [Out, MarshalAs(UnmanagedType.U4)] out System.UInt32 preferences - ); - - void SetOptinStatus( - [In, MarshalAs(UnmanagedType.U4)] System.UInt32 optinStatus - ); - } - - [ComImport()] - [ComVisible(false)] - [Guid("2508FDF0-EF80-4366-878E-C9F024B8D981")] - internal interface SVsLog - { - } -} diff --git a/src/Compilers/Core/Portable/SqmServiceProvider.cs b/src/Compilers/Core/Portable/SqmServiceProvider.cs deleted file mode 100644 index 0c1cc72b4737e0706406058b040a80d36a80e3b8..0000000000000000000000000000000000000000 --- a/src/Compilers/Core/Portable/SqmServiceProvider.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using System.IO; -using System.Threading; -using System.Runtime.InteropServices; -using Microsoft.CodeAnalysis; - -namespace Microsoft.VisualStudio.Shell.Interop -{ - internal static class SqmServiceProvider - { - public enum CompilerType - { - Compiler = 0, - CompilerServer = 1, - Interactive = 2 - } - - // SQM Constants ----- these are NOT FINAL --- real ones will be assigned when approved by VS telemetry team - public const uint CSHARP_APPID = 50u; - public const uint BASIC_APPID = 51u; - - public const uint DATAID_SQM_ROSLYN_COMPILERTYPE = 1354u; // 0=Compiler, 1= CompilerServer, 2=Interactive - public const uint DATAID_SQM_BUILDVERSION = 1523u; // Roslyn Build Version - public const uint DATAID_SQM_ROSLYN_SOURCES = 1360u; // No of source code files this compile - public const uint DATAID_SQM_ROSLYN_REFERENCES = 1359u; // No of referenced assemblies this compile - public const uint DATAID_SQM_ROSLYN_ERRORNUMBERS = 1356u; // List of errors [and warnings as errors] - public const uint DATAID_SQM_ROSLYN_WARNINGNUMBERS = 1366u; // List of warnings [excluding warnings as errors] - public const uint DATAID_SQM_ROSLYN_WARNINGLEVEL = 1365u; // -warn:n 0 - 4 - public const uint DATAID_SQM_ROSLYN_WARNINGASERRORS = 1364u; // -warnaserror[+/-] - public const uint DATAID_SQM_ROSLYN_SUPPRESSWARNINGNUMBERS = 1361u; // -nowarn:blah;blah;blah - public const uint DATAID_SQM_ROSLYN_WARNASERRORS_NUMBERS = 1362u; // -warnaserror+:blah;blah;blah - public const uint DATAID_SQM_ROSLYN_WARNASWARNINGS_NUMBERS = 1363u; // -warnaserror-:blah;blah;blah - public const uint DATAID_SQM_ROSLYN_OUTPUTKIND = 1358u; // /target:exe|winexe ... [ConsoleApplication = 0, WindowsApplication = 1, DynamicallyLinkedLibrary = 2, NetModule = 3, WindowsRuntimeMetadata = 4] - public const uint DATAID_SQM_ROSLYN_LANGUAGEVERSION = 1357u; - public const uint DATAID_SQM_ROSLYN_EMBEDVBCORE = 1355u; - - private delegate bool QueryServiceDelegate([In]ref Guid rsid, [In]ref Guid riid, [Out]out IVsSqmMulti vssqm); - - [DllImport("kernel32.dll")] - private static extern IntPtr GetProcAddress(IntPtr moduleHandle, String procName); - - [DllImport("kernel32.dll", SetLastError = true)] - private static extern IntPtr LoadLibrary(String libPath); - - private static Optional s_queryService; - private static readonly object s_guard = new object(); - - private static QueryServiceDelegate TryGetSqmServiceDelegateCore(string baseDirectory) - { - try - { - // These DLLs are only distributed with VS, they are installed to "Program Files (x86)\MSBuild\14.0\Bin". - IntPtr vssqmdll = IntPtr.Zero; - string vssqmpath; - if (IntPtr.Size == 8) - { - vssqmpath = Path.Combine(baseDirectory, @"sqmamd64\vssqmmulti.dll"); - } - else - { - vssqmpath = Path.Combine(baseDirectory, @"sqmx86\vssqmmulti.dll"); - } - vssqmdll = SqmServiceProvider.LoadLibrary(vssqmpath); - if (vssqmdll != IntPtr.Zero) - { - IntPtr queryServicePtr = SqmServiceProvider.GetProcAddress(vssqmdll, "QueryService"); - return (QueryServiceDelegate)Marshal.GetDelegateForFunctionPointer(queryServicePtr, typeof(QueryServiceDelegate)); - } - } - catch (Exception e) - { - Debug.Assert(false, string.Format("Could not get dll entry point: {0}", e.ToString())); - } - return null; - } - - private static QueryServiceDelegate TryGetSqmServiceDelegate(string baseDirectory) - { - lock (s_guard) - { - if (!s_queryService.HasValue) - { - s_queryService = TryGetSqmServiceDelegateCore(baseDirectory); - } - - return s_queryService.Value; - } - } - - public static IVsSqmMulti TryGetSqmService(string baseDirectory) - { - IVsSqmMulti result = null; - Guid rsid = new Guid("2508FDF0-EF80-4366-878E-C9F024B8D981"); - Guid riid = new Guid("B17A7D4A-C1A3-45A2-B916-826C3ABA067E"); - QueryServiceDelegate queryService = TryGetSqmServiceDelegate(baseDirectory); - if (queryService != null) - { - try - { - queryService(ref rsid, ref riid, out result); - } - catch (Exception e) - { - Debug.Assert(false, string.Format("Could not get SQM service or have SQM related errors: {0}", e.ToString())); - return null; - } - } - return result; - } - } -} diff --git a/src/Compilers/Server/ServerShared/CSharpCompilerServer.cs b/src/Compilers/Server/ServerShared/CSharpCompilerServer.cs index 77d37074c744e378816ab700cd51a5d35a82407d..7098177ce3288437fa2ba9b15c185a63206dcc9e 100644 --- a/src/Compilers/Server/ServerShared/CSharpCompilerServer.cs +++ b/src/Compilers/Server/ServerShared/CSharpCompilerServer.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.CSharp; -using Microsoft.VisualStudio.Shell.Interop; namespace Microsoft.CodeAnalysis.CompilerServer { @@ -25,21 +24,5 @@ internal CSharpCompilerServer(Func compiler.Run(tw)); } - - protected override uint GetSqmAppID() - { - return SqmServiceProvider.CSHARP_APPID; - } - - 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.Length); - sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_REFERENCES, (uint)Arguments.ReferencePaths.Length); - } } } diff --git a/src/Compilers/Shared/Vbc.cs b/src/Compilers/Shared/Vbc.cs index 0c26952872c4bae29e0bd164d133da1ffd967d02..9b73e66e30c0e909b3d2979414c51676aa6086a9 100644 --- a/src/Compilers/Shared/Vbc.cs +++ b/src/Compilers/Shared/Vbc.cs @@ -3,7 +3,6 @@ using System; using System.IO; using System.Linq; -using Microsoft.VisualStudio.Shell.Interop; using Microsoft.CodeAnalysis.CommandLine; namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine @@ -23,22 +22,6 @@ internal static int Run(string[] args, BuildPaths buildPaths, TextWriter textWri var compiler = new Vbc(responseFile, buildPaths, args, analyzerLoader); return ConsoleUtil.RunWithUtf8Output(compiler.Arguments.Utf8Output, textWriter, tw => compiler.Run(tw)); } - - protected override uint GetSqmAppID() - { - return SqmServiceProvider.CSHARP_APPID; - } - - 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()); - } } } diff --git a/src/Compilers/Test/Utilities/CSharp.Desktop/MockCSharpCompiler.cs b/src/Compilers/Test/Utilities/CSharp.Desktop/MockCSharpCompiler.cs index f3e7ef38623104291bd9e1dbce25716109893618..7e7c09c8ed43fd6b937101c541433ae2e73eb5ca 100644 --- a/src/Compilers/Test/Utilities/CSharp.Desktop/MockCSharpCompiler.cs +++ b/src/Compilers/Test/Utilities/CSharp.Desktop/MockCSharpCompiler.cs @@ -6,7 +6,6 @@ using System.IO; using System.Runtime.InteropServices; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.VisualStudio.Shell.Interop; namespace Microsoft.CodeAnalysis.CSharp.Test.Utilities { @@ -26,16 +25,6 @@ public MockCSharpCompiler(string responseFile, string baseDirectory, string[] ar _analyzers = analyzers; } - protected override void CompilerSpecificSqm(IVsSqmMulti sqm, uint sqmSession) - { - throw new NotImplementedException(); - } - - protected override uint GetSqmAppID() - { - throw new NotImplementedException(); - } - protected override ImmutableArray ResolveAnalyzersFromArguments( List diagnostics, CommonMessageProvider messageProvider) diff --git a/src/Compilers/Test/Utilities/VisualBasic/MockVbi.vb b/src/Compilers/Test/Utilities/VisualBasic/MockVbi.vb index d4068bd75ea83f464bd8cdd43a69db4e8c81c5e1..dc08b8fc0789c151809ecd96d5f5af3a53e44a2a 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/MockVbi.vb +++ b/src/Compilers/Test/Utilities/VisualBasic/MockVbi.vb @@ -4,7 +4,6 @@ Imports System.IO Imports System.Reflection Imports System.Runtime.InteropServices Imports Microsoft.CodeAnalysis.VisualBasic -Imports Microsoft.VisualStudio.Shell.Interop Friend Class MockVbi Inherits VisualBasicCompiler @@ -12,12 +11,4 @@ Friend Class MockVbi Public Sub New(responseFile As String, baseDirectory As String, args As String()) MyBase.New(VisualBasicCommandLineParser.ScriptRunner, responseFile, args, Path.GetDirectoryName(GetType(VisualBasicCompiler).Assembly.Location), baseDirectory, RuntimeEnvironment.GetRuntimeDirectory(), Nothing, New DesktopAnalyzerAssemblyLoader()) End Sub - - Protected Overrides Sub CompilerSpecificSqm(sqm As IVsSqmMulti, sqmSession As UInteger) - Throw New NotImplementedException() - End Sub - - Protected Overrides Function GetSqmAppID() As UInteger - Throw New NotImplementedException() - End Function End Class diff --git a/src/Compilers/Test/Utilities/VisualBasic/MockVisualBasicCompiler.vb b/src/Compilers/Test/Utilities/VisualBasic/MockVisualBasicCompiler.vb index d8000337e08db21bcd10fede0c66f0707f170ccd..1e5b146b194f381380e94568dfacfff0217e7aab 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/MockVisualBasicCompiler.vb +++ b/src/Compilers/Test/Utilities/VisualBasic/MockVisualBasicCompiler.vb @@ -4,7 +4,6 @@ Imports System.Collections.Immutable Imports System.IO Imports System.Runtime.InteropServices Imports Microsoft.CodeAnalysis.Diagnostics -Imports Microsoft.VisualStudio.Shell.Interop Friend Class MockVisualBasicCompiler Inherits VisualBasicCompiler @@ -26,14 +25,6 @@ Friend Class MockVisualBasicCompiler _analyzers = analyzers End Sub - Protected Overrides Function GetSqmAppID() As UInteger - Return SqmServiceProvider.BASIC_APPID - End Function - - Protected Overrides Sub CompilerSpecificSqm(sqm As IVsSqmMulti, sqmSession As UInteger) - Throw New NotImplementedException - End Sub - Protected Overrides Function ResolveAnalyzersFromArguments( diagnostics As List(Of DiagnosticInfo), messageProvider As CommonMessageProvider) As ImmutableArray(Of DiagnosticAnalyzer) diff --git a/src/Compilers/VisualBasic/Portable/CommandLine/VisualBasicCommandLineParser.vb b/src/Compilers/VisualBasic/Portable/CommandLine/VisualBasicCommandLineParser.vb index 46dc9323390634f0fc29481589e60c786be7721c..1530e3a75f4861f46242ce6d67511cb8da5f8208 100644 --- a/src/Compilers/VisualBasic/Portable/CommandLine/VisualBasicCommandLineParser.vb +++ b/src/Compilers/VisualBasic/Portable/CommandLine/VisualBasicCommandLineParser.vb @@ -146,7 +146,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim delaySignSetting As Boolean? = Nothing Dim moduleAssemblyName As String = Nothing Dim moduleName As String = Nothing - Dim sqmsessionguid As Guid = Nothing Dim touchedFilesPath As String = Nothing Dim features = New List(Of String)() Dim reportAnalyzer As Boolean = False @@ -350,10 +349,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Continue For Case "sqmsessionguid" + ' The use of SQM is deprecated in the compiler but we still support the command line parsing for + ' back compat reasons. value = RemoveQuotesAndSlashes(value) If String.IsNullOrWhiteSpace(value) = True Then AddDiagnostic(diagnostics, ERRID.ERR_MissingGuidForOption, value, name) Else + Dim sqmsessionguid As Guid If Not Guid.TryParse(value, sqmsessionguid) Then AddDiagnostic(diagnostics, ERRID.ERR_InvalidFormatForGuidForOption, value, name) End If @@ -1332,7 +1334,6 @@ lVbRuntimePlus: .EmitPdb = emitPdb, .DefaultCoreLibraryReference = defaultCoreLibraryReference, .PreferredUILang = preferredUILang, - .SqmSessionGuid = sqmsessionguid, .ReportAnalyzer = reportAnalyzer } End Function diff --git a/src/Scripting/CSharp/Hosting/CommandLine/Csi.cs b/src/Scripting/CSharp/Hosting/CommandLine/Csi.cs index e0fe237949f4517f45c77dfb4dbc09a2713d0f1d..9095b7b01e58dad7a15f545f198e52acd723aeef 100644 --- a/src/Scripting/CSharp/Hosting/CommandLine/Csi.cs +++ b/src/Scripting/CSharp/Hosting/CommandLine/Csi.cs @@ -7,7 +7,6 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Scripting; using Microsoft.CodeAnalysis.Scripting.Hosting; -using Microsoft.VisualStudio.Shell.Interop; namespace Microsoft.CodeAnalysis.CSharp.Scripting.Hosting { @@ -36,15 +35,5 @@ public override void PrintHelp(TextWriter consoleOutput) { consoleOutput.Write(CSharpScriptingResources.InteractiveHelp); } - - protected override uint GetSqmAppID() - { - return SqmServiceProvider.CSHARP_APPID; - } - - protected override void CompilerSpecificSqm(IVsSqmMulti sqm, uint sqmSession) - { - sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_COMPILERTYPE, (uint)SqmServiceProvider.CompilerType.Interactive); - } } } diff --git a/src/Scripting/VisualBasic/Hosting/CommandLine/Vbi.vb b/src/Scripting/VisualBasic/Hosting/CommandLine/Vbi.vb index 0b78c41e848e2ecba59c397701809b804b1c2297..76ab96ca417a9dfc058aa45a16c1670a00131227 100644 --- a/src/Scripting/VisualBasic/Hosting/CommandLine/Vbi.vb +++ b/src/Scripting/VisualBasic/Hosting/CommandLine/Vbi.vb @@ -5,7 +5,6 @@ Imports System.Reflection Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Scripting.Hosting Imports Microsoft.CodeAnalysis.VisualBasic -Imports Microsoft.VisualStudio.Shell.Interop Namespace Microsoft.CodeAnalysis.VisualBasic.Scripting.Hosting @@ -30,14 +29,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Scripting.Hosting Public Overrides Sub PrintHelp(consoleOutput As TextWriter) consoleOutput.Write(VBScriptingResources.InteractiveHelp) End Sub - - Protected Overrides Function GetSqmAppID() As UInteger - Return SqmServiceProvider.BASIC_APPID - End Function - - Protected Overrides Sub CompilerSpecificSqm(sqm As IVsSqmMulti, sqmSession As UInteger) - sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_COMPILERTYPE, CType(SqmServiceProvider.CompilerType.Interactive, UInteger)) - End Sub End Class End Namespace diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/Sqm.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/Sqm.cs deleted file mode 100644 index 0041e875c3389adbb922cf46c29d39ff602ee578..0000000000000000000000000000000000000000 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/Sqm.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Diagnostics; -using System.Linq; -using Microsoft.VisualStudio.Shell.Interop; -using Roslyn.Utilities; - -namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem -{ - /// - /// We want to track Roslyn adoption through SQM. This datapoint - /// is used in a cube to track how many sessions are using the - /// Roslyn language services. - /// - internal static class Sqm - { - // From the V_VSAppID variable - // 38 CS VB Language Services - private const uint CS_VB_Language_Services = 38; - private const bool AlwaysSendTelemetryEvenIfUserIsOptedOut = false; - - private const int DATAID_SQM_STARTUPAPPBUILDNUMBERSTRING = 780; - private const int DATAID_SQM_STARTUPAPPBUILDNUMBER = 11; - private const int DATAID_DP_PRIVATEDOGFOODBUILDNUMBER = 1437; - private const int DATAID_DP_PRIVATEBUILDNUMBER = 1438; - private const int DATAID_SQM_USERTYPE = 37; - - private static int s_sqmGuidSet = 0; - - public static void LogSession(IVsSqmMulti session, bool isMicrosoftInternal) - { - SetVSSessionGuid(session); - ReportVSSessionSQM(session, isMicrosoftInternal); - } - - private static void SetVSSessionGuid(IVsSqmMulti session) - { - // Set the VSSessionGuid so our out-of-proc compiler builds can record sqm data - if (!(System.Threading.Interlocked.CompareExchange(ref s_sqmGuidSet, 1, 0) == 1)) - { - try - { - var globalSessionGuid = session.GetGlobalSessionGuid(); - - // make sure we disable marking global project collection dirty before setting this global property - // otherwise, it will cause full property re-evaluation after this point since project system thinks something related - // to projects has changed. - Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.DisableMarkDirty = true; - Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.SetGlobalProperty("VSSessionGuid", globalSessionGuid.ToString()); - } - finally - { - Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.DisableMarkDirty = false; - } - } - } - - private static void ReportVSSessionSQM(IVsSqmMulti session, bool isMicrosoftInternal) - { - var multiSession = session; - var vsBuild = Process.GetCurrentProcess().MainModule.FileVersionInfo.ProductVersion; - var roslynBuild = FileVersionInfo.GetVersionInfo(typeof(Sqm).Assembly.Location).FileVersion; - - uint sessionHandle; - multiSession.BeginSession(CS_VB_Language_Services, AlwaysSendTelemetryEvenIfUserIsOptedOut, out sessionHandle); - - // Log some common datapoints useful in all cubes - multiSession.SetStringDatapoint(sessionHandle, DATAID_SQM_STARTUPAPPBUILDNUMBERSTRING, vsBuild); - LogNumericBuildNumber(multiSession, sessionHandle, DATAID_SQM_STARTUPAPPBUILDNUMBER, vsBuild); - - multiSession.SetStringDatapoint(sessionHandle, DATAID_DP_PRIVATEDOGFOODBUILDNUMBER, roslynBuild); - LogNumericBuildNumber(multiSession, sessionHandle, DATAID_DP_PRIVATEBUILDNUMBER, roslynBuild); - - multiSession.SetDatapoint(sessionHandle, DATAID_SQM_USERTYPE, isMicrosoftInternal ? 1u : 0); - - multiSession.EndSession(sessionHandle); - } - - 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); - } - } -} diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs index 9b371d1d5ec898819575901da5515c44773fb754..f6454806d1ff48b3f341a1103557b2213c424fee 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs @@ -71,15 +71,6 @@ internal abstract class VisualStudioWorkspaceImpl : VisualStudioWorkspace // Ensure the options factory services are initialized on the UI thread this.Services.GetService(); - - var session = serviceProvider.GetService(typeof(SVsLog)) as IVsSqmMulti; - var profileService = serviceProvider.GetService(typeof(SVsFeedbackProfile)) as IVsFeedbackProfile; - - // We have Watson hits where this came back null, so guard against it - if (profileService != null) - { - Sqm.LogSession(session, profileService.IsMicrosoftInternal); - } } internal static HostServices CreateHostServices(SVsServiceProvider serviceProvider) diff --git a/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj b/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj index ee6b2b2d03aa7e0d8309079145b623c6f40cf6b1..72c0285fe3ba95cd6ea1403f5641ec9cd100996d 100644 --- a/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj +++ b/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj @@ -45,7 +45,6 @@ Shared\ConcurrentLruCache.cs - InternalUtilities\ShadowCopyAnalyzerAssemblyLoader.cs @@ -558,7 +557,6 @@ - diff --git a/src/VisualStudio/Telemetry/RoslynTelemetrySetup.cs b/src/VisualStudio/Telemetry/RoslynTelemetrySetup.cs index dc08307dd82a568c144316fadddf48218c2bc0f4..842dffacdfa0e4de31e380e1cecb1c5ea5204fdb 100644 --- a/src/VisualStudio/Telemetry/RoslynTelemetrySetup.cs +++ b/src/VisualStudio/Telemetry/RoslynTelemetrySetup.cs @@ -6,7 +6,7 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.Internal.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.ComponentModelHost; -using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; +using Microsoft.VisualStudio.LanguageServices; using Microsoft.VisualStudio.LanguageServices.Setup; namespace Microsoft.VisualStudio.LanguageServices.Telemetry @@ -35,7 +35,7 @@ public void Initialize(IServiceProvider serviceProvider) new VSTelemetryActivityLogger(telemetryService), Logger.GetLogger())); - Logger.Log(FunctionId.Run_Environment, KeyValueLogMessage.Create(m => m["Version"] = FileVersionInfo.GetVersionInfo(typeof(Sqm).Assembly.Location).FileVersion)); + Logger.Log(FunctionId.Run_Environment, KeyValueLogMessage.Create(m => m["Version"] = FileVersionInfo.GetVersionInfo(typeof(VisualStudioWorkspace).Assembly.Location).FileVersion)); } } }