Browse Source

CodeCoverage: Null reference fix, remove Debug ...

CodeCoverageMethodElement:
Null reference thrown because Tests does not contain new attributes,
fixed.
Debug.Fail breaks Test, removed.
pull/343/head
Dragan 12 years ago
parent
commit
59e908eba3
  1. 8
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageMethodElement.cs

8
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageMethodElement.cs

@ -133,9 +133,9 @@ namespace ICSharpCode.CodeCoverage
stream.Position = 0; stream.Position = 0;
string textSource = ICSharpCode.AvalonEdit.Utils.FileReader.ReadFileContent(stream, Encoding.Default); string textSource = ICSharpCode.AvalonEdit.Utils.FileReader.ReadFileContent(stream, Encoding.Default);
retSource = new CodeCoverageStringTextSource(textSource); retSource = new CodeCoverageStringTextSource(textSource);
} catch (Exception e) { Debug.Fail(e.Message); } } catch (Exception) {}
} }
} catch (Exception e) { Debug.Fail(e.Message); } } catch (Exception) {}
cacheGetSource_LastFileName = filename; cacheGetSource_LastFileName = filename;
cacheGetSource_LastSource = retSource; cacheGetSource_LastSource = retSource;
@ -158,11 +158,11 @@ namespace ICSharpCode.CodeCoverage
sp.Offset = (int)GetDecimalAttributeValue(xSPoint.Attribute("offset")); sp.Offset = (int)GetDecimalAttributeValue(xSPoint.Attribute("offset"));
sp.BranchExitsCount = (int)GetDecimalAttributeValue(xSPoint.Attribute("bec")); sp.BranchExitsCount = (int)GetDecimalAttributeValue(xSPoint.Attribute("bec"));
sp.BranchExitsVisit = (int)GetDecimalAttributeValue(xSPoint.Attribute("bev")); sp.BranchExitsVisit = (int)GetDecimalAttributeValue(xSPoint.Attribute("bev"));
sp.FileID = xSPoint.Attribute("fileid").Value?? "0"; sp.FileID = xSPoint.Attribute("fileid") != null? xSPoint.Attribute("fileid").Value : "0";
if (sp.FileID == "0") { if (sp.FileID == "0") {
// SequencePoint from not covered (not runnable) file // SequencePoint from not covered (not runnable) file
// ie: interface with CodeContractClass/CodeContractClassFor // ie: interface with CodeContractClass/CodeContractClassFor
sp.Document = xSPoint.Attribute("fileid").Value?? ""; sp.Document = xSPoint.Attribute("fileid") != null? xSPoint.Attribute("fileid").Value : "";
} }
else if (sp.FileID == this.FileID) { else if (sp.FileID == this.FileID) {
// This method SequencePoint (from this.FileName) // This method SequencePoint (from this.FileName)

Loading…
Cancel
Save