You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So that we don't end up nuking the whole git repository!
It was my misunderstanding that targets setup with `AfterTargets` would not run if the target specified was skipped because its condition would evaluate to false. When trying to add multitargeting, the `MoveCoverletReport` target ran anyway and the `CoverletReport` item evaluated to empty which in turn made `CoverletReportParentDirectory` evaluate to `..`, i.e the root of the git repository which was then deleted by the `RemoveDir` task.
Two safeties have been added:
1. Add the same `Condition="$(TargetFramework) != ''"` on all targets running after `GenerateHtmlCoverageReport`.
1. Add `Condition="$(CoverletReport) != ''"` when defining the `CoverletReportParentDirectory` item.
This incident would never have happened in the first place if:
1. I could have used `$([System.IO.Directory]::GetParent($(CoverletReport)))` instead of `$([System.IO.Path]::Combine($(CoverletReport),'..'))` because the former would have crashed when `$(CoverletReport)` evaluates to empty, the latter just silently picked the wrong parent directory. But I did not use the former because of a [Rider bug][1].
2. VS Test would not [create test results in non deterministic paths][2]. The `MoveCoverletReport` target would not have been needed at all.
[1]: https://youtrack.jetbrains.com/issue/RIDER-92994
[2]: microsoft/vstest#2378
0 commit comments