Skip to content

Commit cb25c6f

Browse files
Skip file check existence for source generated file (#1091)
Skip file check existence for source generated file
1 parent dab6454 commit cb25c6f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/coverlet.core/Helpers/InstrumentationHelper.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ public bool EmbeddedPortablePdbHasLocalSource(string module, out string firstNot
125125
// We verify all docs and return false if not all are present in local
126126
// We could have false negative if doc is not a source
127127
// Btw check for all possible extension could be weak approach
128-
if (!_fileSystem.Exists(docName))
128+
// We exlude from the check the autogenerated source file(i.e. source generators)
129+
if (!_fileSystem.Exists(docName) && !docName.EndsWith(".g.cs"))
129130
{
130131
firstNotFoundDocument = docName;
131132
return false;
@@ -172,7 +173,8 @@ public bool PortablePdbHasLocalSource(string module, out string firstNotFoundDoc
172173
// We verify all docs and return false if not all are present in local
173174
// We could have false negative if doc is not a source
174175
// Btw check for all possible extension could be weak approach
175-
if (!_fileSystem.Exists(docName))
176+
// We exlude from the check the autogenerated source file(i.e. source generators)
177+
if (!_fileSystem.Exists(docName) && !docName.EndsWith(".g.cs"))
176178
{
177179
firstNotFoundDocument = docName;
178180
return false;

0 commit comments

Comments
 (0)