Skip to content

Commit

Permalink
Merge pull request OpenCover#387 from OpenCover/master
Browse files Browse the repository at this point in the history
Create release candidate
  • Loading branch information
ddur committed Dec 23, 2015
2 parents 25e57d7 + acd4178 commit e75bab9
Show file tree
Hide file tree
Showing 67 changed files with 2,369 additions and 989 deletions.
6 changes: 5 additions & 1 deletion Build.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
@echo off
build\nant-0.91-alpha2\bin\nant.exe -f:"%cd%"\default.build %1
build\nant-0.91-alpha2\bin\nant.exe -f:"%cd%"\default.build %1
@echo.
@echo %date%
@echo %time%
@echo.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ You will need:
1. Visual Studio VS2013 (Community Edition) or later with C# and C++
2. WiX 3.9 or later (http://wix.codeplex.com/releases/view/136891)
3. Specflow (http://visualstudiogallery.msdn.microsoft.com/9915524d-7fb0-43c3-bb3c-a8a14fbd40ee)
4. Windows SDK 8 and .NET Framework Tools (https://msdn.microsoft.com/en-us/windows/desktop/bg162891.aspx)

All other software should be included with this repository.

Expand Down Expand Up @@ -84,10 +85,13 @@ No Git? Don't worry you can download the latest code as a [zip file](http://gith
I would like to thank

* JetBrains for my Open Source [ReSharper licence](http://www.jetbrains.com/resharper/),
<img src="http://www.jetbrains.com/company/docs/logo_jetbrains.png"/>

* [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/),
* 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,


I'd also like to thank my family, employers, colleagues and friends for all their support.
4 changes: 4 additions & 0 deletions ReleaseNotes.tmp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Version [[version]]
#376 protect buffer allocation in multithreaded environment (fix)
#335 allow short wait timeout to be configured (feature)

Version 4.6.210 (rc - remove)
#282 exclude by process (feature)
#246 auto crash reports (feature)
#329 address ArgumentOutOfRangeException (potentially related to #274) (fix for VS2015)
Expand Down
1 change: 1 addition & 0 deletions build/installer.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<include name="Gendarme.Rules.Maintainability.dll" />
<include name="log4net.dll" />
<include name="log4net.config" />
<include name="CrashReporter.NET.dll" />
</fileset>
<fileset basedir="${solution.folder}\bin\Release\x86" prefix="x86">
<include name="OpenCover.Profiler.dll" />
Expand Down
8 changes: 4 additions & 4 deletions build/version.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<project name="OpenCover" >

<target name="netfx.tools" >
<fail message="Please install 'Microsoft Windows SDK for Windows 7 and .NET Framework'" unless="${directory::exists(netfx.tools.folder)}" />
<fail message="Please install 'Microsoft Windows SDK for Windows 8 and .NET Framework'" unless="${directory::exists(netfx.tools.folder)}" />
</target>

<target name="create-snk" depends="netfx.tools">
<property name="source.opencover.snk.file" value="${build.folder}\..\..\..\keys\opencover.snk" />
<property name="opencover.snk.file" value="${build.folder}\Version\opencover.snk" />
<property name="opencover.public.snk.file" value="${build.folder}\Version\opencover.public.snk" />

<copy file="${source.opencover.snk.file}" todir="${build.folder}\Version"
if="${file::exists(source.opencover.snk.file) and not file::exists(opencover.snk.file)}" />
<copy file="${source.opencover.snk.file}" todir="${build.folder}\Version"
if="${file::exists(source.opencover.snk.file) and not file::exists(opencover.snk.file)}" />

<exec program="${netfx.tools.folder}\sn.exe" commandline='-k "${opencover.snk.file}"' unless="${file::exists(opencover.snk.file)}"/>
<exec program="${netfx.tools.folder}\sn.exe" commandline='-p "${opencover.snk.file}" "${opencover.public.snk.file}"' unless="${file::exists(opencover.public.snk.file)}"/>
Expand All @@ -37,4 +37,4 @@
<echo message="${machine.os} => ${machine.version}" />
</target>

</project>
</project>
6 changes: 3 additions & 3 deletions main/OpenCover.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static int Main(string[] args)
{
Logger.FatalFormat("An exception occured: {0}", ex.Message);
Logger.FatalFormat("stack: {0}", ex.StackTrace);
Logger.FatalFormat("A report has been sent to the OenCover development team...");
Logger.FatalFormat("A report has been sent to the OpenCover development team...");
}

ReportCrash(ex);
Expand Down Expand Up @@ -109,7 +109,7 @@ private static void ReportCrash(Exception exception)

uploader.SendAnonymousReport(SendRequestState.GetClientLib(), state.GetApplication(), state.GetExceptionDescription(true));
}
catch (Exception ex)
catch (Exception)
{
System.Console.WriteLine("Failed to send crash report :(");
}
Expand Down Expand Up @@ -303,7 +303,7 @@ private static void RunService(CommandLineParser parser, Action<StringDictionary
// Stopping w3svc host
if (parser.Target.ToLower().Equals("w3svc"))
{
logger.InfoFormat("Stopping svchost to clean up environment variables for w3svc", parser.Target);
logger.InfoFormat("Stopping svchost to clean up environment variables for {0}", parser.Target);
if (ServiceEnvironmentManagementEx.IsServiceStartAutomatic(parser.Target))
{
logger.InfoFormat("Please note that the 'w3svc' service may automatically start");
Expand Down
4 changes: 4 additions & 0 deletions main/OpenCover.Framework/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public void Initialise(IFilter filter,
_container = builder.Build();
}

/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
/// <filterpriority>2</filterpriority>
public void Dispose()
{
if (_container == null) return;
Expand Down
13 changes: 12 additions & 1 deletion main/OpenCover.Framework/CommandLineParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public string Usage()
builder.AppendLine(" [-hideskipped:File|Filter|Attribute|MissingPdb|All,[File|Filter|Attribute|MissingPdb|All]]");
builder.AppendLine(" [-log:[Off|Fatal|Error|Warn|Info|Debug|Verbose|All]]");
builder.AppendLine(" [-service[:byname]]");
builder.AppendLine(" [-servicestarttimeout:1m23s");
builder.AppendLine(" [-servicestarttimeout:<minutes+seconds e.g. 1m23s>");
builder.AppendLine(" [-communicationtimeout:<integer, e.g. 10000>");
builder.AppendLine(" [-threshold:<max count>]");
builder.AppendLine(" [-enableperformancecounters]");
builder.AppendLine(" [-skipautoprops]");
Expand Down Expand Up @@ -190,6 +191,11 @@ public void ExtractAndValidateArguments()
ReturnCodeOffset = ExtractValue<int>("returntargetcode", () =>
{ throw new InvalidOperationException("The return target code offset must be an integer"); });
break;
case "communicationtimeout":
CommunicationTimeout = ExtractValue<int>("communicationtimeout", () =>
{ throw new InvalidOperationException(string.Format("The communication timeout must be an integer: {0}", GetArgumentValue("communicationtimeout"))); });
CommunicationTimeout = Math.Max(Math.Min(CommunicationTimeout, 60000), 10000);
break;
case "filter":
Filters = ExtractFilters(GetArgumentValue("filter"));
break;
Expand Down Expand Up @@ -511,6 +517,11 @@ private void ValidateArguments()
/// Instructs the console to print its version and exit
/// </summary>
public bool PrintVersion { get; private set; }

/// <summary>
/// Sets the 'short' timeout between profiler and host (normally 10000ms)
/// </summary>
public int CommunicationTimeout { get; private set; }
}

}
15 changes: 12 additions & 3 deletions main/OpenCover.Framework/Communication/CommunicationManager.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using log4net.Repository.Hierarchy;
using OpenCover.Framework.Manager;
using OpenCover.Framework.Service;

namespace OpenCover.Framework.Communication
{
Expand Down Expand Up @@ -48,6 +45,11 @@ public CommunicationManager(IMessageHandler messageHandler)
_messageHandler = messageHandler;
}

/// <summary>
/// Process a communication related message from a profiler
/// </summary>
/// <param name="mcb"></param>
/// <param name="offloadHandling"></param>
public void HandleCommunicationBlock(IManagedCommunicationBlock mcb, Action<ManagedBufferBlock> offloadHandling)
{
mcb.ProfilerRequestsInformation.Reset();
Expand All @@ -71,6 +73,10 @@ private static void SendChunkAndWaitForConfirmation(int writeSize, IManagedCommu
mcb.InformationReadByProfiler.Reset();
}

/// <summary>
/// process a results block from the profiler
/// </summary>
/// <param name="mmb"></param>
public byte[] HandleMemoryBlock(IManagedMemoryBlock mmb)
{
mmb.ProfilerHasResults.Reset();
Expand All @@ -88,6 +94,9 @@ public byte[] HandleMemoryBlock(IManagedMemoryBlock mmb)
return newData;
}

/// <summary>
/// Communication is over
/// </summary>
public void Complete()
{
_messageHandler.Complete();
Expand Down
13 changes: 13 additions & 0 deletions main/OpenCover.Framework/Communication/MarshalWapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,24 @@ public interface IMarshalWrapper
/// </summary>
public class MarshalWrapper : IMarshalWrapper
{
/// <summary>
/// Map pinned memory to a structure
/// </summary>
/// <typeparam name="T">The type of the structure</typeparam>
/// <param name="pinnedMemory"></param>
/// <returns></returns>
public T PtrToStructure<T>(IntPtr pinnedMemory)
{
return (T)Marshal.PtrToStructure(pinnedMemory, typeof(T));
}

/// <summary>
/// Map a structure to pinned memory
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="structure"></param>
/// <param name="pinnedMemory"></param>
/// <param name="fDeleteOld"></param>
public void StructureToPtr<T>(T structure, IntPtr pinnedMemory, bool fDeleteOld)
{
Marshal.StructureToPtr(structure, pinnedMemory, fDeleteOld);
Expand Down
14 changes: 14 additions & 0 deletions main/OpenCover.Framework/Communication/MessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ public MessageHandler(IProfilerCommunication profilerCommunication, IMarshalWrap
_memoryManager = memoryManager;
}

/// <summary>
/// Process a Standard Message
/// </summary>
/// <param name="msgType"></param>
/// <param name="mcb"></param>
/// <param name="chunkReady"></param>
/// <param name="offloadHandling"></param>
/// <returns></returns>
public int StandardMessage(MSG_Type msgType, IManagedCommunicationBlock mcb, Action<int, IManagedCommunicationBlock> chunkReady, Action<ManagedBufferBlock> offloadHandling)
{
IntPtr pinnedMemory = mcb.PinnedDataCommunication.AddrOfPinnedObject();
Expand Down Expand Up @@ -319,6 +327,9 @@ private int HandleTrackProcessMessage(IntPtr pinnedMemory)

private int _readSize;

/// <summary>
/// Maximum size of a base message
/// </summary>
public int ReadSize
{
get
Expand All @@ -344,6 +355,9 @@ public int ReadSize
}
}

/// <summary>
/// Finished
/// </summary>
public void Complete()
{
_profilerCommunication.Stopping();
Expand Down
10 changes: 9 additions & 1 deletion main/OpenCover.Framework/Communication/Messages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ namespace OpenCover.Framework.Communication
/// <summary>
/// The command supportd by the host
/// </summary>
// ReSharper disable InconsistentNaming
// ReSharper disable InconsistentNaming
// ReSharper disable once EnumUnderlyingTypeIsInt
public enum MSG_Type : int
{
/// <summary>
Expand Down Expand Up @@ -338,8 +339,15 @@ public struct MSG_AllocateBuffer_Request
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct MSG_AllocateBuffer_Response
{
/// <summary>
/// is the buffer allocated
/// </summary>
[MarshalAs(UnmanagedType.Bool)]
public bool allocated;

/// <summary>
/// The id assigned to the buffer
/// </summary>
public uint bufferId;
}

Expand Down
Loading

0 comments on commit e75bab9

Please sign in to comment.