@@ -22,7 +22,7 @@ internal class SourceRootTranslator : ISourceRootTranslator
2222 private readonly IFileSystem _fileSystem ;
2323 private readonly Dictionary < string , List < SourceRootMapping > > _sourceRootMapping ;
2424 private readonly Dictionary < string , List < string > > _sourceToDeterministicPathMapping ;
25- private const string MappingFileName = "CoverletSourceRootsMapping" ;
25+ private readonly string _mappingFileName ;
2626 private Dictionary < string , string > _resolutionCacheFiles ;
2727
2828 public SourceRootTranslator ( ILogger logger , IFileSystem fileSystem )
@@ -32,7 +32,7 @@ public SourceRootTranslator(ILogger logger, IFileSystem fileSystem)
3232 _sourceRootMapping = new Dictionary < string , List < SourceRootMapping > > ( ) ;
3333 }
3434
35- public SourceRootTranslator ( string moduleTestPath , ILogger logger , IFileSystem fileSystem )
35+ public SourceRootTranslator ( string moduleTestPath , ILogger logger , IFileSystem fileSystem , IAssemblyAdapter assemblyAdapter )
3636 {
3737 _logger = logger ?? throw new ArgumentNullException ( nameof ( logger ) ) ;
3838 _fileSystem = fileSystem ?? throw new ArgumentNullException ( nameof ( fileSystem ) ) ;
@@ -44,6 +44,10 @@ public SourceRootTranslator(string moduleTestPath, ILogger logger, IFileSystem f
4444 {
4545 throw new FileNotFoundException ( $ "Module test path '{ moduleTestPath } ' not found", moduleTestPath ) ;
4646 }
47+
48+ string assemblyName = assemblyAdapter . GetAssemblyName ( moduleTestPath ) ;
49+ _mappingFileName = $ "CoverletSourceRootsMapping_{ assemblyName } ";
50+
4751 _sourceRootMapping = LoadSourceRootMapping ( Path . GetDirectoryName ( moduleTestPath ) ) ;
4852 _sourceToDeterministicPathMapping = LoadSourceToDeterministicPathMapping ( _sourceRootMapping ) ;
4953 }
@@ -75,7 +79,7 @@ private Dictionary<string, List<SourceRootMapping>> LoadSourceRootMapping(string
7579 {
7680 var mapping = new Dictionary < string , List < SourceRootMapping > > ( ) ;
7781
78- string mappingFilePath = Path . Combine ( directory , MappingFileName ) ;
82+ string mappingFilePath = Path . Combine ( directory , _mappingFileName ) ;
7983 if ( ! _fileSystem . Exists ( mappingFilePath ) )
8084 {
8185 return mapping ;
0 commit comments