Skip to content
This repository was archived by the owner on Nov 15, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
60d5521
#329 ensure no two buffers can have same id
sawilde Aug 20, 2015
6fbd38a
buffer should start at 1
sawilde Aug 21, 2015
e1d7fcd
refactor (tidy-up) MessageHandler
sawilde Aug 22, 2015
fa10cdd
#329 try flushing BufferSize + wrap access to memory buffer
sawilde Aug 22, 2015
34cd4b7
remove some compiler warnings
sawilde Aug 22, 2015
932479a
#329 - use a semaphore to act as a sync object around shared memory a…
sawilde Aug 29, 2015
f6add07
#329 - add more diagnostics around the communication channel
sawilde Sep 1, 2015
bf26a6d
address some of the XML comment warnings
sawilde Sep 1, 2015
a4309ac
#329 retry allocating buffer (3 x 3s) rather than a single 10s
sawilde Sep 1, 2015
af2a679
address more XML doco warnings
sawilde Sep 1, 2015
be0ed1e
#329 log exceptions and respond safely
sawilde Sep 2, 2015
0820553
#329 configure special logger for debug output
sawilde Sep 2, 2015
c6e2196
more doco tidy up
sawilde Sep 3, 2015
cc6dbfd
distinguish between host and profiler logging in DebugView
sawilde Sep 3, 2015
d9c20c8
#329 alter the way we start the thread that handles each profiler ins…
sawilde Sep 3, 2015
7b0908b
update readme
sawilde Sep 5, 2015
2eb03df
move signer project
sawilde Sep 5, 2015
765087b
#246 spike: Use crash reporter (nuget) and DrDump
sawilde Sep 5, 2015
7784148
#329 add diagnostics around semaphore handling (try to find hang)
sawilde Sep 7, 2015
95e8025
#329 wait for buffers to close before forcing a shutdown of host
sawilde Sep 8, 2015
33f8cec
#310 skip first branch in a generated MoveNext
sawilde Sep 9, 2015
e31ead4
#282 Only track coverage from certain processes
sawilde Sep 10, 2015
8630bc1
#282 check parsing of args is non-greedy
sawilde Sep 14, 2015
f9bf9f9
Merge branch 'crash_report'
sawilde Sep 14, 2015
df8f244
update notes [skip ci]
sawilde Sep 14, 2015
dc084c1
Merge pull request #345 from sawilde/master
sawilde Sep 15, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,36 @@ The primary repo for the project is [on GitHub](https://github.com/opencover/ope
### Team communication
[![Join the chat at https://gitter.im/OpenCover/opencover](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/OpenCover/opencover?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Team communications can also be done via [slack](http://slack.com), raise an issue to request access (include your email - obfuscated if you wish) and we will send you an invite then just visit the [team page](https://opencover.slack.com/) to sign up and join the conversation.
### WIKI
Please review the [wiki pages](https://github.com/opencover/opencover/wiki/_pages) on how to use OpenCover and take particular interest in the [Usage guide](https://github.com/opencover/opencover/wiki/Usage).

### Issues
Please raise issues on GitHub, if you can repeat the issue then please provide a sample to make it easier for us to also repeat it and then implement a fix. Please do not hijack unrelated issues, I would rather you create a new issue than add noise to an unrelated issue.

[Dropbox](http://db.tt/VanqFDn) is very useful for sharing files alternatively you could create a [gist](https://gist.github.com/).

### Licence
All Original Software is licensed under the [MIT Licence](https://github.com/opencover/opencover/blob/master/License.md) and does not apply to any other 3rd party tools, utilities or code which may be used to develop this application.

If anyone is aware of any licence violations that this code may be making please inform the developers so that the issue can be investigated and rectified.

### WIKI
Please review the [wiki pages](https://github.com/opencover/opencover/wiki/_pages) on how to use OpenCover and take particular interest in the [Usage guide](https://github.com/opencover/opencover/wiki/Usage).
### Integration Test support
OpenCover was initially created to support unit testing techniques such as TDD and tools like NUnit and MSTest. Over time others have found ways to use OpenCover for integration testing especially in tricky scenarios such as IIS and Windows Services. I'll put links here as to how people have achieved this however as they say YMMV (You Mileage May Vary).

### Service support
Note that .zip and .nuget packages (at least) will not ACL files so that a low-privilege service can execute them -- manually add the service principal with read/execute privilege to the OpenCover.Profiler.dll ACLs, either through explorer properties or by a `Get-Acl`/`Set-Acl` PowerShell script.
#### IIS support
Please refer to the wiki - [IIS Support](https://github.com/OpenCover/opencover/wiki/IIS-Support)

Launching the profiling operation must be done with Administrator privilege -- this is required to even start the service, and is also needed to create the global objects and set the per-service environment that registers the COM object. Assuming that the COM objects have been pre-registered, the command line to use is like
#### DNX support
Please refer to the wiki - [DNX Support](https://github.com/OpenCover/opencover/wiki/DNX-Support)

OpenCover.console.exe -service:byname -target:<service name> -output:coverage.xml

As this is a blocking operation, launching the coverage gathering a separate process as
#### Win8/Win10 Application Support
Note yet [implemented](https://github.com/OpenCover/opencover/issues/144). Sorry no call for it I assume the WPF way of separating model and UI has led to people getting all they need from unit-tests; I know how that is how it works for me.

start-process OpenCover.console.exe @("-target:<service name>", "-service:byName", "-output:<service name>coverage.xml")

or equivalent in your test scripts.
#### Service support
please refer to the wiki - [Service Support](https://github.com/OpenCover/opencover/wiki/Service-Support)

The `byname` qualifier is used to prevent races if multiple services are being started concurrently by injecting the OpenCover profiling information to the service specific environment.

### Issues
Please raise issues on GitHub, if you can repeat the issue then please provide a sample to make it easier for us to also repeat it and then implement a fix. Please do not hijack unrelated issues, I would rather you create a new issue than add noise to an unrelated issue.

[Dropbox](http://db.tt/VanqFDn) is very useful for sharing files alternatively you could create a [gist](https://gist.github.com/).
#### Silverlight support
Please refer to wiki - [Silverlight support](https://github.com/OpenCover/opencover/wiki/Silverlight-Support)

### Building
You will need:
Expand Down Expand Up @@ -85,7 +86,7 @@ I would like to thank
* JetBrains for my Open Source [ReSharper licence](http://www.jetbrains.com/resharper/),
* [AppVeyor](https://ci.appveyor.com/project/sawilde/opencover) for allowing free build CI services for Open Source projects,
* [Coveralls](https://coveralls.io/r/OpenCover/opencover) for allowing free services for Open Source projects,
* NDepend for my [NDepend licence](http://www.ndepend.com/).
* NDepend for my [NDepend licence](http://www.ndepend.com/),
* the guys at [CodeBetter](http://codebetter.com/), [Devlicious](http://devlicio.us/) and [Los Techies](http://lostechies.com/) who orignally arranged my MSDN licence all those years ago without which I doubt I'd have been able to start OpenCover (now no longer needed as we can build OpenCover using the VS2013 Community Edition),
* the [NextGenUG](http://www.nxtgenug.net/) and their free swag from where I got lots of useful tools,

Expand Down
2 changes: 2 additions & 0 deletions ReleaseNotes.tmp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Version [[version]]
#282 exclude by process (feature)
#246 auto crash reports (feature)
#329 address ArgumentOutOfRangeException (potentially related to #274) (fix for VS2015)
#335 error on unrecognized arguments/prefixes (fix)
#328 exclude types when declaredtype is excluded (fix-feature)
Expand Down
1 change: 1 addition & 0 deletions main/.nuget/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CrashReporterdotNet" version="1.5" />
<package id="coveralls.io" version="1.3.4" />
<package id="curl" version="7.30.0.2" />
<package id="Mono.Gendarme" version="2.11.0.20121120" />
Expand Down
52 changes: 52 additions & 0 deletions main/OpenCover.3rdParty.Signer/CrashReporterSigner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.IO;
using System.Linq;
using System.Reflection;
using Mono.Cecil;

namespace OpenCover.ThirdParty.Signer
{
internal static class CrashReporterSigner
{

private const string Version = "1.5";

private static readonly string GendarmeAssemblyName = string.Format("CrashReporterdotNet.{0}", Version);

public static readonly string TargetFolder = Path.Combine("..", "tools", "CrashReporterSigned");
private static readonly string SourceFolder = Path.Combine("packages", GendarmeAssemblyName, "lib", "net20");
private static readonly string StrongNameKey = Path.Combine("..", "build", "Version", "opencover.3rdparty.snk");


public static bool AlreadySigned(string baseFolder)
{
var frameworkAssembly = Path.Combine(baseFolder, TargetFolder, "CrashReporter.NET.dll");
if (File.Exists(frameworkAssembly))
{
try
{
var frameworkDefinition = AssemblyDefinition.ReadAssembly(frameworkAssembly);
return frameworkDefinition.Name.HasPublicKey;
}
catch
{
}
}
return false;
}

public static void SignAssembly(string baseFolder)
{
var key = Path.Combine(baseFolder, StrongNameKey);
var assembly = Path.Combine(baseFolder, SourceFolder, "CrashReporter.NET.dll");
var newAssembly = Path.Combine(baseFolder, TargetFolder, "CrashReporter.NET.dll");

assembly = Path.GetFullPath(assembly);
newAssembly = Path.GetFullPath(newAssembly);

File.Copy(assembly, newAssembly, true);
var definition = AssemblyDefinition.ReadAssembly(newAssembly);
var keyPair = new StrongNameKeyPair(new FileStream(key, FileMode.Open, FileAccess.Read));
definition.Write(newAssembly, new WriterParameters() { StrongNameKeyPair = keyPair });
}
}
}
Original file line number Diff line number Diff line change
@@ -1,48 +1,23 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Mono.Cecil;

namespace OpenCover.Gendarme.Signer
namespace OpenCover.ThirdParty.Signer
{
class Program
internal static class GendarmeSigner
{
private const string GendarmeVersion = "2.11.0.20121120";

private static readonly string GendarmeAssemblyName = string.Format("Mono.Gendarme.{0}", GendarmeVersion);
private const string GendarmeVersion = "2.11.0.20121120";

private static readonly string TargetFolder = Path.Combine("..", "tools", "GendarmeSigned");
private static readonly string SourceFolder = Path.Combine("packages", GendarmeAssemblyName, "tools");
private static readonly string StrongNameKey = Path.Combine("..", "build", "Version", "opencover.gendarme.snk");

static void Main(string[] args)
{
var assemblyLocation = Assembly.GetAssembly (typeof(Program)).Location;
var assemblyFolder = Path.GetDirectoryName(assemblyLocation);
var baseFolder = Path.Combine(assemblyFolder, "..", "..", "..");
private static readonly string GendarmeAssemblyName = string.Format("Mono.Gendarme.{0}", GendarmeVersion);

var targetDirectory = Path.Combine (baseFolder, TargetFolder);
if (!Directory.Exists(targetDirectory))
Directory.CreateDirectory (targetDirectory);

if (AlreadySigned(baseFolder))
{
Console.WriteLine("Gendarme Framework is already Signed");
return;
}

Console.WriteLine("Signing Gendarme Framework");
SignGendarmeFramework(baseFolder);
public static readonly string TargetFolder = Path.Combine("..", "tools", "GendarmeSigned");
private static readonly string SourceFolder = Path.Combine("packages", GendarmeAssemblyName, "tools");
private static readonly string StrongNameKey = Path.Combine("..", "build", "Version", "opencover.3rdparty.snk");

Console.WriteLine("Signing Gendarme Rules Maintainability");
SignGendarmeRulesMaintainability(baseFolder);
}

private static bool AlreadySigned(string baseFolder)
public static bool AlreadySigned(string baseFolder)
{
var frameworkAssembly = Path.Combine(baseFolder, TargetFolder, "Gendarme.Framework.dll");
if (File.Exists(frameworkAssembly))
Expand All @@ -59,7 +34,7 @@ private static bool AlreadySigned(string baseFolder)
return false;
}

private static void SignGendarmeRulesMaintainability(string baseFolder)
public static void SignGendarmeRulesMaintainability(string baseFolder)
{
var frameworkAssembly = Path.Combine(baseFolder, TargetFolder, "Gendarme.Framework.dll");
var frameworkDefinition = AssemblyDefinition.ReadAssembly(frameworkAssembly);
Expand Down Expand Up @@ -97,7 +72,7 @@ private static void SignGendarmeRulesMaintainability(string baseFolder)

}

private static void SignGendarmeFramework(string baseFolder)
public static void SignGendarmeFramework(string baseFolder)
{
var key = Path.Combine(baseFolder, StrongNameKey);
var assembly = Path.Combine(baseFolder, SourceFolder, "Gendarme.Framework.dll");
Expand All @@ -112,4 +87,4 @@ private static void SignGendarmeFramework(string baseFolder)
definition.Write(newAssembly, new WriterParameters() { StrongNameKeyPair = keyPair });
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectGuid>{0B94C4BF-762B-4722-BF5A-30E7F6D2CB7E}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenCover.Gendarme.Signer</RootNamespace>
<AssemblyName>OpenCover.Gendarme.Signer</AssemblyName>
<RootNamespace>OpenCover.ThirdParty.Signer</RootNamespace>
<AssemblyName>OpenCover.3rdParty.Signer</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
Expand Down Expand Up @@ -65,6 +65,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CrashReporterSigner.cs" />
<Compile Include="GendarmeSigner.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand All @@ -79,6 +81,10 @@
$(SolutionDir)OpenCover.Gendarme.Signer\bin\$(ConfigurationName)\OpenCover.Gendarme.Signer.exe</PostBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">mono OpenCover.Gendarme.Signer.exe</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>cd $(SolutionDir)OpenCover.3rdParty.Signer\bin\$(ConfigurationName)
$(SolutionDir)OpenCover.3rdParty.Signer\bin\$(ConfigurationName)\OpenCover.3rdParty.Signer.exe</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
56 changes: 56 additions & 0 deletions main/OpenCover.3rdParty.Signer/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;
using System.IO;
using System.Reflection;

namespace OpenCover.ThirdParty.Signer
{
class Program
{

static void Main(string[] args)
{
var assemblyLocation = Assembly.GetAssembly (typeof(Program)).Location;
var assemblyFolder = Path.GetDirectoryName(assemblyLocation) ?? string.Empty;
var baseFolder = Path.Combine(assemblyFolder, "..", "..", "..");

SignGendarme(baseFolder);
SignCrashReporter(baseFolder);
}

private static void SignGendarme(string baseFolder)
{
var targetDirectory = Path.Combine(baseFolder, GendarmeSigner.TargetFolder);
if (!Directory.Exists(targetDirectory))
Directory.CreateDirectory(targetDirectory);

if (GendarmeSigner.AlreadySigned(baseFolder))
{
Console.WriteLine("Gendarme Framework is already Signed");
return;
}

Console.WriteLine("Signing Gendarme Framework");
GendarmeSigner.SignGendarmeFramework(baseFolder);

Console.WriteLine("Signing Gendarme Rules Maintainability");
GendarmeSigner.SignGendarmeRulesMaintainability(baseFolder);
}

private static void SignCrashReporter(string baseFolder)
{
var targetDirectory = Path.Combine(baseFolder, CrashReporterSigner.TargetFolder);
if (!Directory.Exists(targetDirectory))
Directory.CreateDirectory(targetDirectory);

if (CrashReporterSigner.AlreadySigned(baseFolder))
{
Console.WriteLine("CrashReporter is already Signed");
return;
}

Console.WriteLine("Signing CrashReporter");
CrashReporterSigner.SignAssembly(baseFolder);

}
}
}
14 changes: 14 additions & 0 deletions main/OpenCover.Console/CrashReporter/AnonymousData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;

namespace OpenCover.Console.CrashReporter
{
/// <summary>
/// http://crashreporterdotnet.codeplex.com/SourceControl/latest#CrashReporter.NET/trunk/CrashReporter.NET/DrDump/AnonymousData.cs
/// </summary>
internal class AnonymousData
{
public Exception Exception { get; set; }
public string ToEmail { get; set; }
public Guid? ApplicationGuid { get; set; }
}
}
Loading