diff --git a/default.build b/default.build index 65617a930..5edc0bbb1 100644 --- a/default.build +++ b/default.build @@ -82,6 +82,12 @@ + + + + + + diff --git a/main/OpenCover.Console/Program.cs b/main/OpenCover.Console/Program.cs index 78bde4bf8..5e8076555 100644 --- a/main/OpenCover.Console/Program.cs +++ b/main/OpenCover.Console/Program.cs @@ -98,12 +98,15 @@ static int Main(string[] args) private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs) { var ex = (Exception)unhandledExceptionEventArgs.ExceptionObject; - Logger.Fatal("At: CurrentDomainOnUnhandledException"); - 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..."); + //if (!(ex is ExitApplicationWithoutReportingException)) + { + Logger.Fatal("At: CurrentDomainOnUnhandledException"); + 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..."); - ReportCrash((Exception)unhandledExceptionEventArgs.ExceptionObject); + ReportCrash((Exception)unhandledExceptionEventArgs.ExceptionObject); + } Environment.Exit(0); } @@ -124,7 +127,7 @@ private static void ReportCrash(Exception exception) } }; - uploader.SendAnonymousReport(SendRequestState.GetClientLib(), state.GetApplication(), state.GetExceptionDescription(true)); + uploader.SendAnonymousReport(SendRequestState.GetClientLib(), state.GetApplication(), state.GetExceptionDescription(false)); } } catch (Exception) @@ -375,10 +378,9 @@ private static int RunProcess(CommandLineParser parser, Action } catch (Exception ex) { - ex.InformUser(); Logger.ErrorFormat("Failed to execute the following command '{0} {1}'", startInfo.FileName, startInfo.Arguments); - throw new ExitApplicationWithoutReportingException(); } + return 1; } private static void DisplayResults(CoverageSession coverageSession, ICommandLine parser, ILog logger) diff --git a/main/OpenCover.Framework/Manager/ProfilerManager.cs b/main/OpenCover.Framework/Manager/ProfilerManager.cs index 4d214e345..d10db9a74 100644 --- a/main/OpenCover.Framework/Manager/ProfilerManager.cs +++ b/main/OpenCover.Framework/Manager/ProfilerManager.cs @@ -126,10 +126,11 @@ private WaitCallback SetProfilerAttributes(Action> proc { process(dictionary => { - if (dictionary == null) return; - SetProfilerAttributesOnDictionary(profilerKey, profilerNamespace, dictionary); - - environmentKeyRead.Set(); + if (dictionary != null) + { + SetProfilerAttributesOnDictionary(profilerKey, profilerNamespace, dictionary); + environmentKeyRead.Set(); + } }); } finally diff --git a/main/OpenCover.Framework/Persistance/BasePersistance.cs b/main/OpenCover.Framework/Persistance/BasePersistance.cs index 60ea42a81..8bcf0630b 100644 --- a/main/OpenCover.Framework/Persistance/BasePersistance.cs +++ b/main/OpenCover.Framework/Persistance/BasePersistance.cs @@ -663,7 +663,7 @@ private static void TransformSequences_RemoveCompilerGeneratedBranches (IEnumera var sourceLineOrderedSps = method.SequencePoints.OrderBy(sp => sp.StartLine).ThenBy(sp => sp.StartColumn).Where(sp => sp.FileId == method.FileRef.UniqueId).ToArray(); // find getter/setter/static-method "{" offset - if (sourceRepository.IsLeftCurlyBraceSequencePoint(sourceLineOrderedSps[0])) { + if (sourceLineOrderedSps.Length > 0 && sourceRepository.IsLeftCurlyBraceSequencePoint(sourceLineOrderedSps[0])) { startOffset = sourceLineOrderedSps[0].Offset; // find method "}" offset if (sourceLineOrderedSps.Length > 1 && sourceRepository.IsRightCurlyBraceSequencePoint(sourceLineOrderedSps.Last())) {