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 2 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
8 changes: 6 additions & 2 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,12 +66,16 @@ 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)
{
returnCode = returnCodeOffset + 1;
}
catch (Exception ex)
{
Logger.Fatal("At: Program.Main");
Expand Down
20 changes: 16 additions & 4 deletions main/OpenCover.Framework/ProfilerRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@
using System.IO;
using System.Text;
using System.Threading;
using log4net;

namespace OpenCover.Framework
{
/// <summary>
/// This exception is thrown in special cases where program termination must stop
/// but there is no need to raise a crash report
/// </summary>
public class ExitApplicationWithoutReportingException : Exception
{

}

/// <summary>
/// Used to register and unregister the profiler
/// </summary>
Expand All @@ -23,6 +33,8 @@ public class ProfilerRegistration
{
private const string UserRegistrationString = "/n /i:user";

private static readonly ILog Logger = LogManager.GetLogger("OpenCover");

/// <summary>
/// Register the profiler using %SystemRoot%\system\regsvr32.exe
/// </summary>
Expand Down Expand Up @@ -57,15 +69,15 @@ private static void ExecuteRegsvr32(bool userRegistration, bool register, bool i
{
var startInfo = new ProcessStartInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "regsvr32.exe"),
string.Format("/s {2} {0} \"{1}\"",userRegistration ? UserRegistrationString : String.Empty,
GetProfilerPath(is64), register ? string.Empty : "/u")) {CreateNoWindow = true};
GetProfilerPath(is64), register ? string.Empty : "/u")) { CreateNoWindow = true, UseShellExecute = false };

var process = Process.Start(startInfo);
process.WaitForExit();
if (register && 0 != process.ExitCode) // there is an oddity where unregistering the x64 version after the x86 (or vice versa) issues an access denied (5)
{
throw new InvalidOperationException(
string.Format("Failed to register(user:{0},register:{1},is64:{2}):{3} the profiler assembly; you may want to look into permissions or using the -register:user option instead. {4} {5}",
userRegistration, register, is64, process.ExitCode, process.StartInfo.FileName, process.StartInfo.Arguments));
Logger.InfoFormat("Failed to register(user:{0},register:{1},is64:{2}):{3} the profiler assembly; you may want to look into permissions or using the -register:user option instead. {4} {5}",
userRegistration, register, is64, process.ExitCode, process.StartInfo.FileName, process.StartInfo.Arguments);
throw new ExitApplicationWithoutReportingException();
}
}

Expand Down