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 32 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
44dd0a8
add image [skip ci]
sawilde Sep 20, 2015
fa1b7e3
use Resharper C++ suggestions - thanks again to JetBrains for support…
sawilde Sep 20, 2015
4d09d75
Merge branch 'master' of github.com:sawilde/opencover
sawilde Sep 20, 2015
002b89a
Merge branch 'master' of https://github.com/OpenCover/opencover
sawilde Sep 20, 2015
7ad7e07
update wix installer to include symbols by default - improve crash re…
sawilde Sep 22, 2015
ec46832
prep for talk
sawilde Sep 27, 2015
17983ae
housekeeping
sawilde Nov 8, 2015
b918e21
Add line feed to traces
lanfeust69 Nov 10, 2015
f6e0330
Fix incorrect concurrent use of collections
lanfeust69 Nov 10, 2015
18b62d4
update message #372 [skipci]
sawilde Dec 1, 2015
23f0268
update readme #372 [skipci]
sawilde Dec 1, 2015
f463cc2
#335 allow short wait time to be configured
sawilde Dec 1, 2015
59c8534
#335 extract communication timeout value
sawilde Dec 1, 2015
9638573
update dogfood.cmd
sawilde Dec 1, 2015
9e78fd3
Merge remote-tracking branch 'refs/remotes/OpenCover/master'
Dec 6, 2015
fefb9ea
Fix compile on VS 2013 Community Edition
Dec 6, 2015
31a11aa
Change outputXml64 name
Dec 6, 2015
ae32ac0
Fix xml-result file double dot extension (..xml)
Dec 6, 2015
c920a07
If method has no sequences -> remove branches
Dec 6, 2015
a07b482
Select only branches within sequence offset
Dec 6, 2015
f7cd8ce
Exclude some compiler generated branches?
Dec 6, 2015
84efecc
Revert "Exclude some compiler generated branches?"
Dec 7, 2015
ea8fa08
Merge branch 'master' of https://github.com/OpenCover/opencover
sawilde Dec 7, 2015
c36eb67
#335 pass connection timeout value through
sawilde Dec 7, 2015
2f1b63b
Merge pull request #377 from ddur/NewBranchTest
Dec 8, 2015
e60009d
Source connection
Dec 11, 2015
939d8d1
Add CrashReporter to zip distribution
Dec 14, 2015
e274d40
Add Signed CrashReporter
Dec 14, 2015
dbf4d54
Regex Filter Valid Branch Points
Dec 15, 2015
757e9ea
More regex matches
Dec 15, 2015
136b381
Merge branch 'master' of https://github.com/lanfeust69/opencover into…
sawilde Dec 15, 2015
73e7325
#376 only lock on buffer allocation if failed initially (performance)
sawilde Dec 15, 2015
62cbb49
#246 add missing assemblies
sawilde Dec 15, 2015
4ec44f8
update temp
sawilde Dec 15, 2015
9db3624
Cannot match include
Dec 16, 2015
635e99e
Enable Contract.EnsuresOnThrow, add comments
Dec 16, 2015
34fdc4a
Merge pull request #380 from ddur/Build&CrashReporter
Dec 16, 2015
1aa5512
Echo date&time (for local use)
Dec 16, 2015
a54647a
Merge pull request #381 from ddur/Filter-Valid-BranchPoints
Dec 16, 2015
542224a
Merge branch 'master' of https://github.com/OpenCover/opencover
Dec 16, 2015
f4aff5e
Merge pull request #382 from ddur/master
Dec 16, 2015
f905078
Remove all Contract branches
Dec 17, 2015
2748eed
Merge pull request #383 from ddur/master
Dec 17, 2015
47874d5
Remove Regex Match, Exclude BP's by Offset
Dec 17, 2015
b057f57
Merge pull request #384 from ddur/master
Dec 17, 2015
685bfdb
add sleep if yielding the thread fails (avoids spinning the CPU)
molnargab Dec 20, 2015
27f7f48
Merge branch 'master' of https://github.com/OpenCover/opencover
sawilde Dec 21, 2015
9f2bc78
#376 use concurrent map
sawilde Dec 21, 2015
1370d04
fix spelling mistake
sawilde Dec 21, 2015
9772367
Merge pull request #385 from molnargab/sleep_if_yield_fails
sawilde Dec 21, 2015
bdc4cc2
Merge branch 'master' of https://github.com/OpenCover/opencover
sawilde Dec 21, 2015
f7aa165
update notes
sawilde Dec 21, 2015
54c551b
#366 add lock protection over around Module.Alias access by base pers…
sawilde Dec 21, 2015
d87319e
Merge pull request #386 from sawilde/master
sawilde Dec 21, 2015
b57bdda
Remove duplicate empty SequencePoint & Refactored
Dec 23, 2015
e0a3292
Merge Resolve Conflicts
Dec 23, 2015
1acf3f4
Merge pull request #388 from ddur/master
ddur Dec 23, 2015
db4d463
Disable problematic code
Dec 23, 2015
df37d58
Merge branch 'master' of https://github.com/OpenCover/opencover into …
Dec 23, 2015
f63bc88
Enable Remove Unvisited SequencePoint Duplicates
Dec 23, 2015
acd4178
Merge pull request #389 from ddur/master
ddur Dec 23, 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
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.
3 changes: 3 additions & 0 deletions ReleaseNotes.tmp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Version [[version]]
#376 protect buffer allocation in multithreaded environment (fix)

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
12 changes: 8 additions & 4 deletions main/OpenCover.Framework/Model/InstrumentationPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace OpenCover.Framework.Model
public class InstrumentationPoint
{
private static int _instrumentPoint;
private static object _addInstrumentPointSync = new object();
private static readonly List<InstrumentationPoint> InstrumentPoints;

static InstrumentationPoint()
Expand Down Expand Up @@ -114,10 +115,13 @@ public static bool AddVisitCount(uint spid, uint trackedMethodId, int sum = 1)
/// </summary>
public InstrumentationPoint()
{
UniqueSequencePoint = (uint)Interlocked.Increment(ref _instrumentPoint);
InstrumentPoints.Add(this);
OrigSequencePoint = UniqueSequencePoint;
}
lock (_addInstrumentPointSync)
{
UniqueSequencePoint = (uint)++_instrumentPoint;
InstrumentPoints.Add(this);
OrigSequencePoint = UniqueSequencePoint;
}
}

/// <summary>
/// Store the number of visits
Expand Down
7 changes: 5 additions & 2 deletions main/OpenCover.Framework/Model/SequencePoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ public class SequencePoint : InstrumentationPoint, IDocumentReference
/// </summary>
[XmlAttribute("ec")]
public int EndColumn { get; set; }


/// <summary>
/// Count of merged branches
/// </summary>
/// <summary>
/// The number of branch exits
/// </summary>
[XmlAttribute("bec")]
public int BranchExitsCount { get; set; }

/// <summary>
/// The number of times the branch exists were visited
/// Visit count of merged branches
/// </summary>
[XmlAttribute("bev")]
public int BranchExitsVisit { get; set; }
Expand Down
1 change: 1 addition & 0 deletions main/OpenCover.Framework/OpenCover.Framework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
<Compile Include="Symbols\CecilSymbolManager.cs" />
<Compile Include="Symbols\ISymbolManager.cs" />
<Compile Include="Symbols\SymbolFolder.cs" />
<Compile Include="Utility\CodeCoverageStringTextSource.cs" />
<Compile Include="Utility\IPerfCounters.cs" />
<Compile Include="Utility\PerfCounters.cs" />
</ItemGroup>
Expand Down
232 changes: 169 additions & 63 deletions main/OpenCover.Framework/Persistance/BasePersistance.cs

Large diffs are not rendered by default.

287 changes: 287 additions & 0 deletions main/OpenCover.Framework/Utility/CodeCoverageStringTextSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
// Copyright (c) https://github.com/ddur
// This code is distributed under MIT license

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using OpenCover.Framework.Model;

namespace OpenCover.Framework.Utility
{
/// <summary>
/// FileType enum
/// </summary>
public enum FileType : byte {
/// <summary>
/// Unsupported file extension
/// </summary>
Unsupported,

/// <summary>
/// File extension is ".cs"
/// </summary>
CSharp,

/// <summary>
/// File extension is ".vb"
/// </summary>
VBasic
}
/// <summary>StringTextSource (ReadOnly)
/// <remarks>Line and column counting starts at 1.</remarks>
/// </summary>
public class CodeCoverageStringTextSource
{
/// <summary>
/// File Type by file name extension
/// </summary>
public FileType FileType = FileType.Unsupported;
private readonly string textSource;
private struct lineInfo {
public int Offset;
public int Length;
}
private readonly lineInfo[] lines;
/// <summary>
/// Constructor
/// </summary>
/// <param name="source"></param>
public CodeCoverageStringTextSource(string source)
{
this.textSource = source;

lineInfo line;
var lineInfoList = new List<lineInfo>();
int offset = 0;
int counter = 0;
bool newLine = false;
bool cr = false;
bool lf = false;

foreach ( ushort ch in textSource ) {
switch (ch) {
case 0xD:
if (lf||cr) {
newLine = true; // cr after cr|lf
} else {
cr = true; // cr found
}
break;
case 0xA:
if (lf) {
newLine = true; // lf after lf
} else {
lf = true; // lf found
}
break;
default:
if (cr||lf) {
newLine = true; // any non-line-end char after any line-end
}
break;
}
if (newLine) { // newLine detected - add line
line = new lineInfo();
line.Offset = offset;
line.Length = counter - offset;
lineInfoList.Add(line);
offset = counter;
cr = false;
lf = false;
newLine = false;
}
++counter;
}

// Add last line
line = new lineInfo();
line.Offset = offset;
line.Length = counter - offset;
lineInfoList.Add(line);

// Store to readonly field
lines = lineInfoList.ToArray();
}

/// <summary>Return text/source using SequencePoint line/col info
/// </summary>
/// <param name="sp"></param>
/// <returns></returns>
public string GetText(SequencePoint sp) {
return this.GetText(sp.StartLine, sp.StartColumn, sp.EndLine, sp.EndColumn );
}

/// <summary>Return text at Line/Column/EndLine/EndColumn position
/// <remarks>Line and Column counting starts at 1.</remarks>
/// </summary>
/// <param name="Line"></param>
/// <param name="Column"></param>
/// <param name="EndLine"></param>
/// <param name="EndColumn"></param>
/// <returns></returns>
public string GetText(int Line, int Column, int EndLine, int EndColumn) {

var text = new StringBuilder();
string line;
bool argOutOfRange;

if (Line==EndLine) {

#region One-Line request
line = GetLine(Line);

//Debug.Assert(!(Column < 1), "Column < 1");
//Debug.Assert(!(Column > EndColumn), "Column > EndColumn");
//Debug.Assert(!(EndColumn > line.Length + 1), string.Format ("Single Line EndColumn({0}) > line.Length({1})",EndColumn, line.Length ));
//Debug.Assert(!(EndColumn > line.Length + 1), line);

argOutOfRange = Column < 1
|| Column > EndColumn
|| EndColumn > line.Length;
if (!argOutOfRange) {
text.Append(line.Substring(Column-1,EndColumn-Column));
}
#endregion

} else if (Line<EndLine) {

#region Multi-line request

#region First line
line = GetLine(Line);

//Debug.Assert(!(Column < 1), "Column < 1");
//Debug.Assert(!(Column > line.Length), string.Format ("First MultiLine EndColumn({0}) > line.Length({1})",EndColumn, line.Length ));

argOutOfRange = Column < 1
|| Column > line.Length;
if (!argOutOfRange) {
text.Append(line.Substring(Column-1));
}
#endregion

#region More than two lines
for ( int lineIndex = Line+1; lineIndex < EndLine; lineIndex++ ) {
text.Append ( GetLine ( lineIndex ) );
}
#endregion

#region Last line
line = GetLine(EndLine);

//Debug.Assert(!(EndColumn < 1), "EndColumn < 1");
//Debug.Assert(!(EndColumn > line.Length), string.Format ("Last MultiLine EndColumn({0}) > line.Length({1})",EndColumn, line.Length ));

argOutOfRange = EndColumn < 1
|| EndColumn > line.Length;
if (!argOutOfRange) {
text.Append(line.Substring(0,EndColumn));
}
#endregion

#endregion

} else {
//Debug.Fail("Line > EndLine");
}
return text.ToString();
}

/// <summary>
/// Return number of lines in source
/// </summary>
public int LinesCount {
get {
return lines.Length;
}
}

/// <summary>Return SequencePoint enumerated line
/// </summary>
/// <param name="LineNo"></param>
/// <returns></returns>
public string GetLine ( int LineNo ) {

string retString = String.Empty;

if ( LineNo > 0 && LineNo <= lines.Length ) {
lineInfo lineInfo = lines[LineNo-1];
retString = textSource.Substring(lineInfo.Offset, lineInfo.Length);
} else {
//Debug.Fail( "Line number out of range" );
}

return retString;
}

/// <summary>
///
/// </summary>
/// <param name="ToIndent"></param>
/// <param name="TabSize"></param>
/// <returns></returns>
public static string IndentTabs ( string ToIndent, int TabSize ) {

string retString = ToIndent;
if ( ToIndent.Contains ( "\t" ) ) {
int counter = 0;
int remains = 0;
int repeat = 0;
char prevChar = char.MinValue;
var indented = new StringBuilder();
foreach ( char currChar in ToIndent ) {
if ( currChar == '\t' ) {
remains = counter % TabSize;
repeat = remains == 0 ? TabSize : remains;
indented.Append( ' ', repeat );
} else {
indented.Append ( currChar, 1 );
if ( char.IsLowSurrogate(currChar)
&& char.IsHighSurrogate(prevChar)
) { --counter; }
}
prevChar = currChar;
++counter;
}
retString = indented.ToString();
}
return retString;
}

/// <summary>
/// Get line-parsed source from file name
/// </summary>
/// <param name="filename"></param>
/// <returns></returns>
public static CodeCoverageStringTextSource GetSource(string filename) {

var retSource = (CodeCoverageStringTextSource)null;
try {
using (Stream stream = new FileStream(filename, FileMode.Open, FileAccess.Read)) {
try {
stream.Position = 0;
using (var reader = new StreamReader (stream, Encoding.Default, true)) {
retSource = new CodeCoverageStringTextSource(reader.ReadToEnd());
switch (Path.GetExtension(filename).ToLowerInvariant()) {
case ".cs":
retSource.FileType = FileType.CSharp;
break;
case ".vb":
retSource.FileType = FileType.VBasic;
break;
default:
retSource.FileType = FileType.Unsupported;
break;
}
}
} catch (Exception) {}
}
} catch (Exception) {}

return retSource;
}

}
}
1 change: 1 addition & 0 deletions main/OpenCover.NugetPackage/OpenCover.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<file src="main\bin\Release\OpenCover.Extensions.pdb" target="tools"/>
<file src="main\bin\Release\log4net.config" target="tools"/>
<file src="main\bin\Release\log4net.dll" target="tools"/>
<file src="main\bin\Release\CrashReporter.NET.dll" target="tools"/>
<file src="main\OpenCover.Documentation\Usage.rtf" target="docs"/>
<file src="ReleaseNotes.txt" target="docs" />
<file src="main\bin\Release\OpenCover.MSBuild.dll" target="MSBuild"/>
Expand Down
Loading