File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed
MsTestPlatform/CodeCoverage Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 88
99namespace FineCodeCoverage . Engine . MsTestPlatform . CodeCoverage
1010{
11-
1211 [ Export ( typeof ( IRunSettingsTemplate ) ) ]
1312 internal class RunSettingsTemplate : IRunSettingsTemplate
1413 {
@@ -221,11 +220,21 @@ private XElement GetMsDataCollectorCodeCoverageElement(XDocument templateDocumen
221220 return msDataCollector . GetStrictDescendant ( "Configuration/CodeCoverage" ) ;
222221 }
223222
223+ // hacky. due to tests
224+ private string SafeFilePathEscape ( string path )
225+ {
226+ if ( path == null )
227+ {
228+ return null ;
229+ }
230+ return XmlFileEscaper . Escape ( path ) ;
231+ }
232+
224233 public string Replace ( string templatedXml , IRunSettingsTemplateReplacements replacements )
225234 {
226235 return templatedXml
227- . Replace ( replacementLookups . ResultsDirectory , replacements . ResultsDirectory )
228- . Replace ( replacementLookups . TestAdapter , replacements . TestAdapter )
236+ . Replace ( replacementLookups . ResultsDirectory , SafeFilePathEscape ( replacements . ResultsDirectory ) )
237+ . Replace ( replacementLookups . TestAdapter , SafeFilePathEscape ( replacements . TestAdapter ) )
229238 . Replace ( replacementLookups . Enabled , replacements . Enabled )
230239 . Replace ( replacementLookups . ModulePathsExclude , replacements . ModulePathsExclude )
231240 . Replace ( replacementLookups . ModulePathsInclude , replacements . ModulePathsInclude )
Original file line number Diff line number Diff line change 1+ namespace FineCodeCoverage . Core . Utilities
2+ {
3+ internal static class XmlFileEscaper
4+ {
5+ public static string Escape ( string filePath )
6+ {
7+ return filePath . Replace ( "&" , "&" ) . Replace ( "'" , "'" ) ;
8+ }
9+ }
10+ }
Original file line number Diff line number Diff line change 163163 <Compile Include =" $(MSBuildThisFileDirectory)Core\Utilities\LinqToXmlUtil.cs" />
164164 <Compile Include =" $(MSBuildThisFileDirectory)Core\Utilities\Tryer.cs" />
165165 <Compile Include =" $(MSBuildThisFileDirectory)Core\Utilities\VsThreading\IThreadHelper.cs" />
166+ <Compile Include =" $(MSBuildThisFileDirectory)Core\Utilities\XmlFileEscaper.cs" />
166167 <Compile Include =" $(MSBuildThisFileDirectory)Core\Utilities\ZipFileWrapper.cs" />
167168 <Compile Include =" $(MSBuildThisFileDirectory)Impl\CoverageColour\GlyphMargin\RefreshCoverageGlyphsMessage.cs" />
168169 <Compile Include =" $(MSBuildThisFileDirectory)Impl\CoverageColour\MarginBase\CoverageLineTaggerBase.cs" />
You can’t perform that action at this time.
0 commit comments