-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InstrumentationHelper.HasPdb always returns false for deterministic source paths #363
Comments
Additionally, it should have a Eg Oracle.ManagedDataAccess 18.3.0 is failing. |
Part of this fixed in https://github.com/tonerdo/coverlet/pull/367/files |
@sharwell is there a "simple" way to repro this(maybe some simple example on some project ie winform etc...)? |
@MarcoRossignoli If you have WinForms, you should be able to simply set an environment variable |
.net 3.0?I'll give it a try thanks! |
@sharwell can you share a command to repro? I cloned windowsform and printed which modules is skipped
But with or without |
@MarcoRossignoli Here's a repro case:
Expected results: Coverage files in artifacts\coverage have coverage information. Actual results: Coverage files are empty. |
great thank's I'll take a look asap some busy weeks! |
Hi @tmat I'm working on this issue and found dotnet/sourcelink#91 (comment) Btw I don't undestand why it doesn't work on current repo, I've build with
When I debug and try read debug directory for a referenced lib(from test) there is an "incomplete" path for source file inside pdb
If I understood well @sharwell the problem is here...if compiled with |
@MarcoRossignoli yes, the feature improves build determinism by hiding the path |
Is there a standard "start with" prefix in case of deterministic build?I mean can we check |
Yes, the prefix is |
ok thank's Sam! |
It's not always |
In any case, you should not rely on a certain prefix or prefixes. Instead, read the This is an example of a
|
@tmat Interesting. I never saw any path but |
We don't have always msbuild context available, coverlet could be used through vstest collectors(injected by test runtime) and .net tool(console app that manually instrument dll after build and remove the instrumentation at the end restoring files ) where build is done, maybe change the path a bit to include possible 1,2(regex) etc...I mean we should do something based only on produced artifact (pdb/dll) |
@MarcoRossignoli That's unfortunate. Other custom build targets can specify arbitrary path mapping. Let's see if we can come up with a better solution than hard-coding some patterns. At what point do you actually need to read the source files? I'd assume you don't need to do so for the instrumentation itself. So you can produce instrumented binaries using just the pdb and the dll as inputs. Then later when you report which lines are covered you need to read the source files. Correct? |
@tmat we use source in more than one phase, I'll try to explain workflow: Coverlet has got mainly two phase:
We have two "hit candidates" sequence points for lines and branch point for branches. In this phase we use Cecil to read and instrument asm, we use also pdb(DebugInformation) to get documents name and prepare "the structure" to persist and reload after testing.
https://github.com/tonerdo/coverlet/blob/master/src/coverlet.core/Coverage.cs#L352-L385 We'll use file name inside persisted structure also to populate reports file(cobertura etc...) so tools like reportgenerator can show coverage on sources. So to sum up we use "source file name path" everywhere. Feel free to ask if it's not clear. |
@tmat I'm trying with PathMap property on msbuild for now, some observation. PathMap are generated and passed during "build" but "test" run after build so I don't get any PathMap data. BTW if I pass |
@tmat Did you (Roslyn team?) consider systematically embedding the $(PathMap) as as either a standardized assembly attribute or as a resource (with a special name)? Edit: LOL sooooorrry! Just realized that the whole point was to achieve deterministic build (this is what I'm currently fignting for) and that embedding the original paths is a totally stupid idea (to say the least!). |
Any update on this one? We're trying to push more assemblies to be deterministic and it's breaking coverlet |
@clairernovotny something strange on test repo seem that some files are not in git index C:\git\DeterministicBuilds (master -> origin)
λ ls
ClassLibrary1/ ClassLibrary1.sln ClassLibrary1.sln.DotSettings.user Directory.Build.props Directory.Build.targets LICENSE README.md I downloaded zip version, I get error
What am I missing? EDIT: it works with this on props, clearly with no sourcelink infos <ItemGroup>
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
</ItemGroup> |
Weird...I just did a fresh clone and checkout the branch and it worked for me? The zip version def won't work as Source Link requires the git information. After cloning |
Thanks solved, didn't noticed branch name! |
Plan
|
The latest nightly I see for coverlet.collectors was published in March 30, I don't see one from last night? |
Just pushed there was an issue with pushing and also after |
Maybe we should talk versioning.... For prerelease builds, I tend to use a preview tag. In the version.json, you can use Another thing to consider is unifying the versions in the repo to make it easier. Take the highest version, move a single version.json to the root and then bump a major. If you do 6.0, then each build gets it's own patch version automatically. You could also do 6.0.0-preview.{height} as well. |
Yes this is my idea, since nightly we didn't have minor update and it worked until now, so that was an error, thanks, I'll fix asap
I'm not sure about it...at the moment we have 3 drivers(.net tool,msbuild,collectors) and not all version supports all features, have single version could confuse users.
Yes we need to fix nightly, this is last package https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.collector/1.2.1-g4e177f0c57 |
FWIW, I think it could be okay to keep drivers at the same version long as what's in each is documented somewhere. If they all tend to rely on an underlying core library, then that could be what drives the main version. Totally up to you though of course. |
Thank's for the advice, I'll think about cc: @tonerdo |
@clairernovotny nightly should be ok I tool a look at your Rx.NET repo and I prefer leave on version also commit id so users can do fast check without nbgv tool. |
@clairernovotny @tmat support/tests are ok for now, does it make sense work on documentation related to reactiveui/refit#902? |
@MarcoRossignoli What documentation for that issue? Not quite following but all docs are generally useful! |
I mean the workaround to do to support deterministic build coverage, but it's not clear to me if we can release or if it doesn't work, related to your issue on reactive repo. |
I need @tmat to take a closer look at what's going on the the VSTest case. |
When
/p:DeterministicSourcePaths=true
is set,InstrumentationHelper.HasPdb
looks for PDB files in the wrong location. These files are never found, so instrumentation is not performed.https://github.com/tonerdo/coverlet/blob/062b907735901bdf3ad9d4d40953f53a4fe3f364/src/coverlet.core/Helpers/InstrumentationHelper.cs#L74
The text was updated successfully, but these errors were encountered: