提交 bf36f290 编写于 作者: H Heejae Chang 提交者: GitHub

Merge pull request #14948 from heejaechang/watson2

changed to use platform's non fatal watson API
......@@ -277,19 +277,6 @@ public void LogException(object source, Exception exception)
Messages.Add(source.GetType().Name, ToLogFormat(exception));
}
public bool TryLogException(object source, Exception exception)
{
try
{
Messages.Add(source.GetType().Name, ToLogFormat(exception));
return true;
}
catch (Exception)
{
return false;
}
}
private static string ToLogFormat(Exception exception)
{
return exception.Message + Environment.NewLine + exception.StackTrace;
......
// 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.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.ErrorLogger;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.LanguageServices.Implementation.Watson;
using Microsoft.VisualStudio.Shell;
using static Microsoft.CodeAnalysis.RoslynAssemblyHelper;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Log
{
[ExportWorkspaceService(typeof(IErrorLoggerService), ServiceLayer.Host), Export(typeof(IErrorLoggerService)), Shared]
......@@ -28,31 +19,10 @@ public void LogException(object source, Exception exception)
if (ShouldReportCrashDumps(source))
{
using (var report = WatsonErrorReport.CreateNonFatalReport(new ExceptionInfo(exception, name)))
{
report.ReportIfNecessary();
}
WatsonReporter.Report(name, exception);
}
}
public bool TryLogException(object source, Exception exception)
{
bool watsonReportResult = true;
var name = source.GetType().Name;
if (ShouldReportCrashDumps(source))
{
using (var report = WatsonErrorReport.CreateNonFatalReport(new ExceptionInfo(exception, name)))
{
watsonReportResult = report.ReportIfNecessary();
}
}
var activityLogResult = ActivityLog.TryLogError(name, ToLogFormat(exception));
return watsonReportResult && activityLogResult;
}
private bool ShouldReportCrashDumps(object source) => HasRoslynPublicKey(source);
private static string ToLogFormat(Exception exception)
......
// 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.CodeAnalysis;
using System.Collections.ObjectModel;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Watson
{
/// <summary>
/// The kind of consent already obtained from the user.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "We don't want consumers passing None around because it's not a valid value")]
internal enum ErrorReportConsent
{
/// <summary>
/// Allows the error reporting infrastructure to decide whether to ask the user based on their previously established consent level.
/// </summary>
NotAsked = 1,
/// <summary>
/// The user has already approved the submission of this error report through another means.
/// </summary>
/// <remarks>
/// This value should not be used without first obtaining approval from mailto:ddwattac.
/// </remarks>
Approved = 2,
/// <summary>
/// Indicates the user has denied permission to submit the report.
/// </summary>
Denied = 3,
/// <summary>
/// Causes UI to appear to ask the user before submitting the report.
/// </summary>
AlwaysPrompt = 4,
/// <summary>
/// Undocumented.
/// </summary>
Max = 5,
}
/// <summary>
/// The level of detail and size of the dump to submit.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "We don't want consumers passing None around because it's not a valid value")]
internal enum ErrorDumpType
{
/// <summary>
/// Similar to MiniDump but only capture the stack trace of the thread passed into WerReportAddDump
/// which is the most reliable dump type
/// If http://watson has been configured to ask for more information, this can be
/// automatically upgraded to a heap dump.
/// </summary>
MicroDump = 1,
/// <summary>
/// By default, a dump that includes callstacks for all threads is submitted.
/// If http://watson has been configured to ask for more information, this can be
/// automatically upgraded to a heap dump.
/// </summary>
MiniDump = 2,
/// <summary>
/// Produces a much larger CAB that includes the heap.
/// </summary>
HeapDump = 3,
/// <summary>
/// Undocumented.
/// </summary>
Max = 4,
}
/// <summary>
/// The severity of the error being reported.
/// </summary>
internal enum ErrorReportType
{
/// <summary>
/// Undocumented.
/// </summary>
Noncritical,
/// <summary>
/// Undocumented.
/// </summary>
Critical,
/// <summary>
/// Undocumented.
/// </summary>
ApplicationCrash,
/// <summary>
/// Undocumented.
/// </summary>
ApplicationHang,
/// <summary>
/// Undocumented.
/// </summary>
Kernel,
/// <summary>
/// Undocumented.
/// </summary>
Invalid,
}
/// <summary>
/// The type of files that can be added to the report.
/// </summary>
internal enum ErrorFileType
{
/// <summary>
/// A limited minidump that contains only a stack trace.
/// </summary>
Microdump = 1,
/// <summary>
/// A minidump file.
/// </summary>
Minidump = 2,
/// <summary>
/// An extended minidump that contains additional data such as the process memory.
/// </summary>
Heapdump = 3,
/// <summary>
/// The document in use by the application at the time of the event. The document is added only if the server asks for this type of document.
/// </summary>
UserDocument = 4,
/// <summary>
/// Any other type of file. This file will always get added to the cab (but only if the server asks for a cab).
/// </summary>
Other = 5,
}
/// <summary>
/// Flags that can be specified when adding a file to the report.
/// </summary>
[Flags]
internal enum ErrorFileFlags
{
/// <summary>
/// Delete the file once WER is done
/// </summary>
DeleteWhenDone = 0x1,
/// <summary>
/// This file does not contain any PII
/// </summary>
AnonymousData = 0x2,
}
/// <summary>
/// An immutable description of the type of error report to submit.
/// </summary>
internal class ErrorReportSettings
{
/// <summary>
/// Initializes a new instance of the <see cref="ErrorReportSettings"/> class.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Justification = "Ignored")]
public ErrorReportSettings(
ErrorDumpType dumpType = ErrorDumpType.MiniDump,
ErrorReportType reportType = ErrorReportType.Noncritical,
string component = null,
string eventName = null,
ReadOnlyCollection<ErrorFile> files = null)
{
this.DumpType = dumpType;
this.ReportType = reportType;
this.Component = component;
this.EventName = eventName;
this.Files = files;
}
/// <summary>
/// Gets the type of information to include in the error report.
/// </summary>
/// <value>The default value is <see cref="ErrorDumpType.MiniDump"/>.</value>
/// <remarks>
/// This value should typically be left at its default unless you first check with
/// mailto:ddwattac
/// </remarks>
public readonly ErrorDumpType DumpType;
/// <summary>
/// Gets the type of report being
/// </summary>
/// <value>The default value is <see cref="ErrorReportType.Noncritical"/>.</value>
/// <remarks>
/// This value should typically be either <see cref="ErrorReportType.Noncritical"/> or <see cref="ErrorReportType.Critical"/>
/// unless you first check with mailto:ddwattac
/// </remarks>
public readonly ErrorReportType ReportType;
/// <summary>
/// Gets the logical component where the failure occurred.
/// </summary>
/// <value>
/// A non-localized constant value.
/// If <c>null</c> the default component name is used in the report.
/// </value>
/// <remarks>
/// This value should not contain any parameterized values so that a single Watson bucket collects all instances of this failure.
/// Its value will be used to assist in matching a failure to the team that owns the feature.
/// </remarks>
public readonly string Component;
/// <summary>
/// Gets the value that will appear as "Event Name" in the Windows Application Log and in the Watson error report.
/// </summary>
/// <value>
/// A non-localized constant value.
/// If <c>null</c> the default component name is used in the report.
/// </value>
/// <remarks>
/// This value should not contain any parameterized values so that a single Watson bucket collects all instances of this failure.
/// Generally it should be left at <c>null</c> so that the product's reserved event name can be used.
/// </remarks>
public readonly string EventName;
/// <summary>
/// Gets the files being added to report.
/// </summary>
public readonly ReadOnlyCollection<ErrorFile> Files;
}
/// <summary>
/// Encapsulate the info required to add a file to report.
/// </summary>
internal class ErrorFile
{
/// <summary>
/// Initializes a new instance of the <see cref="ErrorFile"/> class.
/// </summary>
public ErrorFile(string path, ErrorFileType type, ErrorFileFlags flags)
{
this.Path = path;
this.Type = type;
this.Flags = flags;
}
/// <summary>
/// Gets the file path being added to report
/// </summary>
public string Path { get; }
/// <summary>
/// Gets the type of the file being added to report.
/// </summary>
public ErrorFileType Type { get; }
/// <summary>
/// Gets the flags of the file being added to report.
/// </summary>
public ErrorFileFlags Flags { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Note: This implementation is copied from $/DevDiv/Feature/VSPro_1/debugger/concord/Dispatcher/Managed/
//////////////////////////////////////////////////////////////////////////////////////////////////////
using System;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Watson
{
/// <summary>
/// Describes non-fatal exception from a given component.
/// </summary>
/// <remarks>
/// This is intended to be used by callers of <see cref="WatsonErrorReport"/> to represent information about the non-fatal error.
/// </remarks>
internal class ExceptionInfo
{
protected ExceptionInfo()
{
}
/// <summary>
/// Creates a new instance of <see cref="ExceptionInfo"/>
/// </summary>
/// <param name="exception">[Required] Exception that triggered this non-fatal error</param>
/// <param name="implementationName">
/// [Required] Name of the component / implementation that triggered the error.
/// This parameter is included in the watson bucket parameters to uniquely identify this error.
/// </param>
public ExceptionInfo(Exception exception, string implementationName)
{
Exception = exception;
ImplementationName = implementationName;
}
/// <summary>
/// Exception that triggered this non-fatal error
/// </summary>
public virtual Exception Exception
{
get;
protected set;
}
/// <summary>
/// The name of the component that triggered this error
/// </summary>
public virtual string ComponentName
{
get
{
return "Roslyn";
}
}
/// <summary>
/// The Fully qualified identifier to what triggered this error
/// This is appended to the ModName parameter on the Watson bucket
/// </summary>
public virtual string ImplementationName
{
get;
protected set;
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Note: This implementation is copied from vsproject\cps\components\implementations\NativeMethods.cs
//////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------
// <copyright file="Watson.cs" company="Microsoft">
// </copyright>
// <summary>Native method calls.</summary>
//-----------------------------------------------------------------------
#if !SILVERLIGHT
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using Microsoft.Win32.SafeHandles;
using DWORD = System.UInt32;
using WORD = System.UInt16;
using LPTSTR = System.String;
using LPBYTE = System.IntPtr;
using HANDLE = System.IntPtr;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Watson
{
internal static unsafe class NativeWin32Stubs
{
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool CloseHandle(HANDLE hObject);
[DllImport("kernel32.dll")]
internal static extern HANDLE CreateEvent(IntPtr lpEventAttributes, bool bManualReset, bool bInitialState, string lpName);
internal const DWORD WAIT_OBJECT_0 = 0;
[DllImport("kernel32.dll", SetLastError = true)]
internal static extern DWORD WaitForMultipleObjects(DWORD nCount, IntPtr[] lpHandles, bool bWaitAll, DWORD dwMilliseconds);
[DllImport("kernel32.dll", SetLastError = true)]
internal static extern HANDLE GetCurrentThread();
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool DuplicateHandle(HANDLE hSourceProcessHandle, HANDLE hSourceHandle, HANDLE hTargetProcessHandle, out HANDLE lpTargetHandle, uint dwDesiredAccess, bool bInheritHandle, uint dwOptions);
[StructLayout(LayoutKind.Sequential)]
internal struct SECURITY_ATTRIBUTES
{
internal int nLength;
internal HANDLE lpSecurityDescriptor;
internal bool bInheritHandle;
}
internal enum DESIRED_ACCESS
{
DUPLICATE_CLOSE_SOURCE = 0x01,
DUPLICATE_SAME_ACCESS = 0x02
}
}
}
#endif
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Note: This implementation is copied from vsproject\cps\components\implementations\NativeMethods.cs
//////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------
// </copyright>
// <summary>Native method calls.</summary>
//-----------------------------------------------------------------------
#if !SILVERLIGHT
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using HANDLE = System.IntPtr;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Watson
{
internal static class Watson
{
private const string ClrRuntimeHostClassIdAsString = "90F1A06E-7712-4762-86B5-7A5EBA6BDB02";
private const string ClrRuntimeHostInterfaceIdAsString = "90F1A06C-7712-4762-86B5-7A5EBA6BDB02";
private const string ClrErrorReportingManagerInterfaceIdAsString = "980D2F1A-BF79-4c08-812A-BB9778928F78";
internal static Guid ClrRuntimeHostClassId = new Guid(ClrRuntimeHostClassIdAsString);
internal static Guid ClrRuntimeHostInterfaceId = new Guid(ClrRuntimeHostInterfaceIdAsString);
internal static Guid ClrErrorReportingManagerInterfaceId = new Guid(ClrErrorReportingManagerInterfaceIdAsString);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
internal struct BucketParameters
{
private int _inited;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
private string _pszEventTypeName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
private string _appName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
private string _appVer;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
private string _appStamp;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
internal string AsmAndModName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
private string _asmVer;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
private string _modStamp;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
private string _methodDef;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
private string _offset;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
private string _exceptionType;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
internal string Component;
internal string EventType { get { return _pszEventTypeName; } }
internal IEnumerable<KeyValuePair<string, string>> Parameters
{
get
{
yield return new KeyValuePair<string, string>("AppName", _appName);
yield return new KeyValuePair<string, string>("AppVer", _appVer);
yield return new KeyValuePair<string, string>("AppStamp", _appStamp);
yield return new KeyValuePair<string, string>("AsmAndModName", this.AsmAndModName);
yield return new KeyValuePair<string, string>("AsmVer", _asmVer);
yield return new KeyValuePair<string, string>("ModStamp", _modStamp);
yield return new KeyValuePair<string, string>("MethodDef", _methodDef);
yield return new KeyValuePair<string, string>("Offset", _offset);
yield return new KeyValuePair<string, string>("ExceptionType", _exceptionType);
yield return new KeyValuePair<string, string>("Component", this.Component);
}
}
}
[Guid(ClrRuntimeHostInterfaceIdAsString), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IClrRuntimeHost
{
void Start();
void Stop();
void SetHostControl(IntPtr hostControl);
IClrControl GetCLRControl();
void UnloadAppDomain(int appDomainId, bool waitUntilDone);
void ExecuteInAppDomain(int appDomainId, IntPtr callback, IntPtr cookie);
int GetCurrentAppDomainId();
int ExecuteApplication(string appFullName, int manifestPathCount, string[] manifestPaths, int activationDataCount, string[] activationData);
int ExecuteInDefaultAppDomain(string assemblyPath, string typeName, string methodName, string argument);
}
[Guid("9065597E-D1A1-4fb2-B6BA-7E1FCE230F61"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IClrControl
{
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetCLRManager([In] ref Guid riid);
void SetAppDomainManagerType(string appDomainManagerAssembly, string appDomainManagerType);
}
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid(ClrErrorReportingManagerInterfaceIdAsString)]
internal interface IClrErrorReportingManager
{
[PreserveSig]
int GetBucketParametersForCurrentException([Out]out BucketParameters parameters);
}
}
}
#endif
// 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.Text;
using System.Reflection;
using Microsoft.VisualStudio.LanguageServices.Implementation.Watson;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Collections;
using Microsoft.VisualStudio.LanguageServices.Telemetry;
using Microsoft.VisualStudio.Telemetry;
namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
......@@ -18,44 +15,20 @@ internal class WatsonReporter
/// <param name="exception">Exception that triggered this non-fatal error</param>
public static void Report(Exception exception)
{
// Log the exception regardless of whether the Watson will be throttled.
Logger.Log(FunctionId.NonFatalWatson, KeyValueLogMessage.Create(dict =>
{
dict["ExceptionType"] = exception.GetType().FullName;
dict["ExceptionStack"] = GetStackTraceString(exception);
}));
using (var report = WatsonErrorReport.CreateNonFatalReport(new ExceptionInfo(exception, "Roslyn")))
{
// Ignore the return value on purpose, we don't care if it actually gets submitted
report.ReportIfNecessary();
}
Report("Roslyn NonFatal Watson", exception);
}
/// <remarks>
/// <see cref="Exception.StackTrace"/> produces inconvenient strings:
/// there are line breaks and "at" is localized.
/// </remarks>
private static string GetStackTraceString(Exception e)
/// <summary>
/// Report Non-Fatal Watson
/// </summary>
/// <param name="description">any description you want to save with this watson report</param>
/// <param name="exception">Exception that triggered this non-fatal error</param>
public static void Report(string description, Exception exception)
{
PooledStringBuilder pooled = PooledStringBuilder.GetInstance();
StringBuilder builder = pooled.Builder;
// No file info, since that would disrupt bucketing.
foreach (StackFrame frame in new StackTrace(e, fNeedFileInfo: false).GetFrames())
{
MethodBase method = frame.GetMethod();
if (method == null) continue;
// method.ToString() does not include the declaring type, so we'll prepend it manually.
// It will appear before the return type, but that won't disrupt our telemetry.
builder.Append(method.ReflectedType.ToString().Replace(',', '\''));
builder.Append("::");
builder.Append(method.ToString().Replace(',', '\''));
builder.Append(';'); // Method signatures should not contain semicolons.
}
return pooled.ToStringAndFree();
TelemetryService.DefaultSession.PostFault(
eventName: FunctionId.NonFatalWatson.GetEventName(),
description: description,
exceptionObject: exception);
}
}
}
......@@ -155,11 +155,6 @@
<Compile Include="Implementation\Versions\SemanticVersionTrackingService.cs" />
<Compile Include="Implementation\ContainedLanguageRefactorNotifyService.cs" />
<Compile Include="Implementation\VirtualMemoryNotificationListener.cs" />
<Compile Include="Implementation\Watson\ErrorReportSettings.cs" />
<Compile Include="Implementation\Watson\ExceptionInfo.cs" />
<Compile Include="Implementation\Watson\NativeWin32Stubs.cs" />
<Compile Include="Implementation\Watson\Watson.cs" />
<Compile Include="Implementation\Watson\WatsonErrorReport.cs" />
<Compile Include="Implementation\Watson\WatsonReporter.cs" />
<Compile Include="Implementation\Workspace\DetailedErrorInfoDialog.xaml.cs">
<DependentUpon>DetailedErrorInfoDialog.xaml</DependentUpon>
......
{
"dependencies": {
"ManagedEsent": "1.9.4",
"Microsoft.CodeAnalysis.Elfie": "0.10.6-rc2",
"Microsoft.VisualStudio.RemoteControl": {
"version": "14.0.249-master2E2DC10C",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Shell.14.0": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Editor": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Language.StandardClassification": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Language.Intellisense": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.Text.Internal" : {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.Internal.VisualStudio.Shell.Interop.14.0.DesignTime": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.Internal.Performance.CodeMarkers.DesignTime": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.Progression": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.GraphModel": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.VisualStudio.ImageCatalog": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.CallHierarchy.Package.Definitions": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.Language.CallHierarchy": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.ComponentModelHost": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.Diagnostics.PerformanceProvider": {
"version": "14.3.25420",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Shell.Design": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.Language.NavigateTo.Interfaces": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.DiaSymReader": "1.1.0-beta1-60625-03",
"Roslyn.Microsoft.Build": "0.0.2",
"NuGet.VisualStudio": {
"version": "3.3.0",
"suppressParent": "all"
}
},
"frameworks": {
"net46": { }
"dependencies": {
"ManagedEsent": "1.9.4",
"Microsoft.CodeAnalysis.Elfie": "0.10.6-rc2",
"Microsoft.VisualStudio.Telemetry": {
"version": "15.0.722-masterBFDFE2B0",
"suppressParent": "all"
},
"Microsoft.VisualStudio.RemoteControl": {
"version": "14.0.249-master2E2DC10C",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Shell.14.0": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Editor": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Language.StandardClassification": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Language.Intellisense": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.Text.Internal": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.Internal.VisualStudio.Shell.Interop.14.0.DesignTime": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.Internal.Performance.CodeMarkers.DesignTime": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.Progression": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.GraphModel": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.VisualStudio.ImageCatalog": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.CallHierarchy.Package.Definitions": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.Language.CallHierarchy": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.ComponentModelHost": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.Diagnostics.PerformanceProvider": {
"version": "14.3.25420",
"suppressParent": "all"
},
"Microsoft.VisualStudio.Shell.Design": {
"version": "14.3.25407",
"suppressParent": "all"
},
"RoslynDependencies.Microsoft.VisualStudio.Language.NavigateTo.Interfaces": {
"version": "14.3.25407",
"suppressParent": "all"
},
"Microsoft.DiaSymReader": "1.1.0-beta1-60625-03",
"Roslyn.Microsoft.Build": "0.0.2",
"NuGet.VisualStudio": {
"version": "3.3.0",
"suppressParent": "all"
}
},
"frameworks": {
"net46": {}
}
}
......@@ -8,6 +8,5 @@ namespace Microsoft.CodeAnalysis.ErrorLogger
internal interface IErrorLoggerService : IWorkspaceService
{
void LogException(object source, Exception exception);
bool TryLogException(object source, Exception exception);
}
}
......@@ -15,20 +15,6 @@ public void LogException(object source, Exception exception)
Logger.GetLogger()?.Log(FunctionId.Extension_Exception, LogMessage.Create(source.GetType().Name + " : " + ToLogFormat(exception)));
}
public bool TryLogException(object source, Exception exception)
{
var logger = Logger.GetLogger();
var name = source.GetType().Name;
if (logger != null)
{
logger.Log(FunctionId.Extension_Exception, LogMessage.Create(name + " : " + ToLogFormat(exception)));
return true;
}
return false;
}
private static string ToLogFormat(Exception exception)
{
return exception.Message + Environment.NewLine + exception.StackTrace;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册