Skip to content

Commit

Permalink
Added PDBs to VSIX and support for localized crash stack traces
Browse files Browse the repository at this point in the history
  • Loading branch information
axodox committed Mar 24, 2017
1 parent 24fd28e commit db7ac42
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
8 changes: 7 additions & 1 deletion AxoCover/AxoCover.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<IncludeDebugSymbolsInVSIXContainer>true</IncludeDebugSymbolsInVSIXContainer>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<StartAction>Program</StartAction>
Expand Down Expand Up @@ -567,22 +568,27 @@
<ProjectReference Include="..\AxoCover.Common\AxoCover.Common.csproj">
<Project>{2ca98ecf-c250-4524-ad43-749b59e60bc1}</Project>
<Name>AxoCover.Common</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;GetCopyToOutputDirectoryItems;DebugSymbolsProjectOutputGroup</IncludeOutputGroupsInVSIX>
</ProjectReference>
<ProjectReference Include="..\AxoCover.Dependencies\AxoCover.Dependencies.csproj">
<Project>{de90f6ef-57c2-4963-8639-505f29a3dbbe}</Project>
<Name>AxoCover.Dependencies</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;GetCopyToOutputDirectoryItems;DebugSymbolsProjectOutputGroup</IncludeOutputGroupsInVSIX>
</ProjectReference>
<ProjectReference Include="..\AxoCover.Host-x64\AxoCover.Host-x64.csproj">
<Project>{30a4d1cc-28c2-4822-b76a-5131ddd3666e}</Project>
<Project>{30a4d1cc-28c2-4822-b76a-5131ddd3666e}</Project>
<Name>AxoCover.Host-x64</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;GetCopyToOutputDirectoryItems;DebugSymbolsProjectOutputGroup</IncludeOutputGroupsInVSIX>
</ProjectReference>
<ProjectReference Include="..\AxoCover.Host-x86\AxoCover.Host-x86.csproj">
<Project>{960e90f5-8a08-4dfa-b268-32bc5fc9f336}</Project>
<Name>AxoCover.Host-x86</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;GetCopyToOutputDirectoryItems;DebugSymbolsProjectOutputGroup</IncludeOutputGroupsInVSIX>
</ProjectReference>
<ProjectReference Include="..\AxoCover.Runner\AxoCover.Runner.csproj">
<Project>{a2fb0e18-82e7-4907-86a3-5add9bda3341}</Project>
<Name>AxoCover.Runner</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;GetCopyToOutputDirectoryItems;DebugSymbolsProjectOutputGroup</IncludeOutputGroupsInVSIX>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
Expand Down
13 changes: 11 additions & 2 deletions AxoCover/Models/Data/StackItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace AxoCover.Models.Data
{
public class StackItem
{
private const string _methodPattern = @"[\w\.<>`\[\],]+\([^\)]*\)";
private const string _methodPattern = @"(?<name>[\w\.<>`\[\],]+)\((?<arguments>[^\)]*)\)";
private static readonly Regex _methodRegex = new Regex(_methodPattern, RegexOptions.Compiled);

private const string _filePathPattern = @"(?:[a-zA-Z]:|\\)(?:\\[^<>:""\/\\|\?\*]*)+\.\w+";
Expand All @@ -28,7 +28,12 @@ public static StackItem[] FromStackTrace(string stackTrace)
var methodMatch = _methodRegex.Match(line);
if (!methodMatch.Success) continue;

var item = new StackItem() { Method = methodMatch.Value };
var item = new StackItem()
{
Method = methodMatch.Value,
MethodName = methodMatch.Groups["name"].Value,
MethodArguments = methodMatch.Groups["arguments"].Value
};

var filePathMatch = _filePathRegex.Match(line);
if (filePathMatch.Success)
Expand All @@ -49,6 +54,10 @@ public static StackItem[] FromStackTrace(string stackTrace)

public string Method { get; set; }

public string MethodName { get; set; }

public string MethodArguments { get; set; }

public string SourceFile { get; set; }

public int Line { get; set; }
Expand Down
20 changes: 8 additions & 12 deletions AxoCover/Models/HockeyClient.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using AxoCover.Models.Extensions;
using AxoCover.Models.Data;
using AxoCover.Models.Extensions;
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;

Expand All @@ -30,8 +30,6 @@ public class HockeyClient : TelemetryManager, IDisposable

private readonly string _uriPrefix;

private readonly Regex _stackRegex;

public HockeyClient(IEditorContext editorContext, IOptions options)
: base(editorContext, options)
{
Expand All @@ -53,8 +51,6 @@ public HockeyClient(IEditorContext editorContext, IOptions options)

_uriPrefix = $"https://rink.hockeyapp.net/api/2/apps/{AppId}/";
_httpClient.BaseAddress = new Uri(_uriPrefix);

_stackRegex = new Regex(@" *at (?<methodName>[^(]*)\([^\)]*\)( in (?<filePath>.*):line (?<line>\d+))?");
}

public override async Task<bool> UploadExceptionAsync(Exception exception)
Expand Down Expand Up @@ -93,16 +89,16 @@ public override async Task<bool> UploadExceptionAsync(Exception exception)
writer.WriteLine(exception.GetType().FullName + ": " + exception.Message);

var stackTrace = exception.StackTrace ?? new StackTrace().ToString();
var stackFrames = _stackRegex.Matches(stackTrace);
var stackFrames = StackItem.FromStackTrace(stackTrace);

if (stackFrames.Count > 0)
if (stackFrames.Length > 0)
{
foreach (Match match in stackFrames)
foreach (var stackItem in stackFrames)
{
writer.Write($" at {match.Groups["methodName"].Value}");
if (match.Groups["filePath"].Success && match.Groups["line"].Success)
writer.Write($" at {stackItem.MethodName}");
if (stackItem.SourceFile != null)
{
writer.WriteLine($"({ Path.GetFileName(match.Groups["filePath"].Value)}:{ match.Groups["line"].Value})");
writer.WriteLine($"({Path.GetFileName(stackItem.SourceFile)}:{stackItem.Line})");
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion AxoCover/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="26901782-38e1-48d4-94e9-557d44db052e" Version="1.1.0.39" Language="en-US" Publisher="Péter Major" />
<Identity Id="26901782-38e1-48d4-94e9-557d44db052e" Version="1.1.0.40" Language="en-US" Publisher="Péter Major" />
<DisplayName>AxoCover</DisplayName>
<Description xml:space="preserve">Nice and free .Net code coverage support for Visual Studio with OpenCover.</Description>
<MoreInfo>https://marketplace.visualstudio.com/items?itemName=axodox1.AxoCover</MoreInfo>
Expand Down

0 comments on commit db7ac42

Please sign in to comment.