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
24 commits
Select commit Hold shift + click to select a range
bf51ad2
refactor around issue #457
sawilde Jan 13, 2016
e85394b
Merge pull request #473 from sawilde/master
sawilde Jan 13, 2016
c11bcb0
MemoryManager tests modified
Jan 13, 2016
7472ba5
Merge pull request #475 from ddur/master
ddur Jan 13, 2016
10f7429
Covers one more branch
Jan 13, 2016
de15bae
Merge pull request #476 from ddur/master
ddur Jan 14, 2016
c0236c6
wrap regsvr32 calls in try/catch + user message #457
sawilde Jan 14, 2016
908f5e8
wrap filter errors and throw a non-reporting exception #477
sawilde Jan 14, 2016
b289635
report on failing to start target process #478
sawilde Jan 14, 2016
af0d9d4
refactor exception to be a non-reporting exeception.
sawilde Jan 14, 2016
f38959f
Note & Remove spaces before matching
Jan 16, 2016
bb9cf92
Merge pull request #483 from ddur/master
ddur Jan 16, 2016
63b14b1
ensure element count in buffer is reset to 0 #482
sawilde Jan 17, 2016
76c0525
Refactor Contract matching
Jan 17, 2016
f7b4ce2
Merge pull request #484 from ddur/master
ddur Jan 17, 2016
8188315
Merge pull request #485 from sawilde/master
sawilde Jan 17, 2016
feb828b
Refactor and comment
Jan 17, 2016
378ed58
Merge pull request #486 from ddur/master
ddur Jan 17, 2016
ffc010d
Make process-filter consistent in all filters
Jan 17, 2016
2340b0e
Merge pull request #487 from ddur/master
ddur Jan 17, 2016
28433ec
Fix regex, find offset on user methods only
Jan 17, 2016
283e67f
Merge pull request #488 from ddur/master
ddur Jan 17, 2016
a5cb9d7
Feature+ Matching assembly by path
Jan 17, 2016
2458590
Merge pull request #489 from ddur/master
ddur Jan 17, 2016
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
45 changes: 28 additions & 17 deletions main/OpenCover.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Program
/// <returns></returns>
static int Main(string[] args)
{
int returnCode;
var returnCode = 0;
var returnCodeOffset = 0;

AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
Expand Down Expand Up @@ -66,18 +66,26 @@ static int Main(string[] args)
container.Initialise(filter, parser, persistance, perfCounter);
if (!persistance.Initialise(outputFile, parser.MergeExistingOutputFile))
return returnCodeOffset + 1;

returnCode = RunWithContainer(parser, container, persistance);
}

perfCounter.ResetCounters();
}
catch (ExitApplicationWithoutReportingException eex)
{
Logger.ErrorFormat("If you are unable to resolve the issue please contact the OpenCover development team");
Logger.ErrorFormat("see https://www.github.com/opencover/opencover/issues");
returnCode = returnCodeOffset + 1;
}
catch (Exception ex)
{
Logger.Fatal("At: Program.Main");
Logger.FatalFormat("An {0} occured: {1}", ex.GetType(), ex.Message);
Logger.FatalFormat("stack: {0}", ex.StackTrace);
Logger.FatalFormat("A report has been sent to the OpenCover development team...");
Logger.FatalFormat("A report has been sent to the OpenCover development team.");
Logger.ErrorFormat("If you are unable to resolve the issue please contact the OpenCover development team");
Logger.ErrorFormat("see https://www.github.com/opencover/opencover/issues");

ReportCrash(ex);

Expand Down Expand Up @@ -356,12 +364,21 @@ private static int RunProcess(CommandLineParser parser, Action<StringDictionary>
startInfo.UseShellExecute = false;
startInfo.WorkingDirectory = parser.TargetDir;

var process = Process.Start(startInfo);
process.WaitForExit();
try
{
var process = Process.Start(startInfo);
process.WaitForExit();

if (parser.ReturnTargetCode)
returnCode = process.ExitCode;
return returnCode;
if (parser.ReturnTargetCode)
returnCode = process.ExitCode;
return returnCode;
}
catch (Exception ex)
{
ex.InformUser();
Logger.ErrorFormat("Failed to execute the following command '{0} {1}'", startInfo.FileName, startInfo.Arguments);
throw new ExitApplicationWithoutReportingException();
}
}

private static void DisplayResults(CoverageSession coverageSession, ICommandLine parser, ILog logger)
Expand Down Expand Up @@ -510,16 +527,10 @@ private static IPerfCounters CreatePerformanceCounter(CommandLineParser parser)
{
return new PerfCounters();
}
else
{
throw new InvalidCredentialException(
"You must be running as an Administrator to enable performance counters.");
}
}
else
{
return new NullPerfCounter();
Logger.Error("You must be running as an Administrator to enable performance counters.");
throw new ExitApplicationWithoutReportingException();
}
return new NullPerfCounter();
}


Expand Down
6 changes: 3 additions & 3 deletions main/OpenCover.Framework/Communication/MessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private int HandleGetSequencePointsMessage(IntPtr pinnedMemory, IManagedCommunic
{
var request = _marshalWrapper.PtrToStructure<MSG_GetSequencePoints_Request>(pinnedMemory);
InstrumentationPoint[] origPoints;
_profilerCommunication.GetSequencePoints(request.processName, request.modulePath, request.assemblyName,
_profilerCommunication.GetSequencePoints(request.processPath, request.modulePath, request.assemblyName,
request.functionToken, out origPoints);
var num = origPoints.Maybe(o => o.Length);

Expand Down Expand Up @@ -169,7 +169,7 @@ private int HandleGetBranchPointsMessage(IntPtr pinnedMemory, IManagedCommunicat
{
var request = _marshalWrapper.PtrToStructure<MSG_GetBranchPoints_Request>(pinnedMemory);
BranchPoint[] origPoints;
_profilerCommunication.GetBranchPoints(request.processName, request.modulePath, request.assemblyName,
_profilerCommunication.GetBranchPoints(request.processPath, request.modulePath, request.assemblyName,
request.functionToken, out origPoints);
var num = origPoints.Maybe(o => o.Length);

Expand Down Expand Up @@ -290,7 +290,7 @@ private int HandleTrackAssemblyMessage(IntPtr pinnedMemory)
try
{
var request = _marshalWrapper.PtrToStructure<MSG_TrackAssembly_Request>(pinnedMemory);
response.track = _profilerCommunication.TrackAssembly(request.processName, request.modulePath, request.assemblyName);
response.track = _profilerCommunication.TrackAssembly(request.processPath, request.modulePath, request.assemblyName);
}
catch (Exception ex)
{
Expand Down
6 changes: 3 additions & 3 deletions main/OpenCover.Framework/Communication/Messages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public struct MSG_TrackAssembly_Request
/// The path to the process
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)]
public string processName;
public string processPath;

/// <summary>
/// The path to the module/assembly
Expand Down Expand Up @@ -144,7 +144,7 @@ public struct MSG_GetSequencePoints_Request
/// The path to the process
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)]
public string processName;
public string processPath;

/// <summary>
/// The path to the module hosting the emthod
Expand Down Expand Up @@ -214,7 +214,7 @@ public struct MSG_GetBranchPoints_Request
/// The path to the process
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)]
public string processName;
public string processPath;

/// <summary>
/// The path to the module hosting the emthod
Expand Down
Loading