-
Prerequisites
initial steps to prepare a demo project for this issue -
Problem
describes the issue in detail -
Conclusion
summary of the issue and conjecture of the root cause -
Workarounds and tracking the solving efforts
audits the solutions hints and efforts to solve the issue
-
Create a new project with an empty class named
ClassUsingPostSharp -
Add via NuGet the package
PostSharp.Patterns.Common -
Add a new integer property named
Counterand put the PostSharpRangeAttributeon it[Range(1, 7)] public int Counter { get; set; }
-
Add via NuGet the package
xUnit -
Add a unit-test for the functionality of PostSharp
by verifying whether an exception is thrown when theCounterproperty is set to a value outside the given range -
Run the unit-test to check that everything is green
-
Add Paket in Magic Mode
-
Run
paket convert-from-nuget -
Run the unit-test to check that everything is still green
- also after closing and re-opening Visual Studio this is still the case
- also after Clean Solution, Rebuild Solution
-
put all files under source control
- use a reasonable
.gitignorefor Visual Studio projects - that was done by each step in this repo here)
- use a reasonable
-
Verify with
git statusthat nothing was forgotten -
Run
git clean -dxfto cleanup all intermediate outputs somewhere in the developing tree -
Run the unit-test again and now it is red!
-
Add via NuGet the package
PostSharp.Patterns.Common -
Run the unit-test again and now it is back green
-
With
git statusyou see that only the filesrc/PostSharpAndPaket/PostSharpAndPaket.csprojwas modified -
With
git reset --hardwe take back the changes to ensure a clean workspace (from git perspective) -
Run the unit-test again and this time it is still green
-
Again we get back the issue by running
git clean -dxf
- This means, that something under the hood in the
obj,bin, .. folder is necessary for PostSharp. - The same issue a co-worker and the CI server will have.
Who can help?
Hint: for all commands below open a Developer Command Prompt for Visual Studio and navigate to the project root folder
-
run build with
msbuild .\src\PostSharpAndPaket\PostSharpAndPaket.sln
-
with commit
56444b("add xUnit console runner") the xUnit Console Runner was included -
so from root we can now run the unit tests via
.\packages\xunit.runner.console\tools\net472\xunit.console.exe .\src\PostSharpAndPaket\bin\Debug\PostSharpAndPaket.dll
-
(re-) install packages after changing
paket.dependenciesfile.paket\paket.exe install -
restoring
packagefolder after cleanup DevTree or switching branches.paket\paket.exe restore
Hint from Daniel Balas (comment: 103888639_58799413)
-
Paket throws the warning
Could not detect any platforms from 'unzipper' in '...\packages\PostSharp\build\unzipper\SharpCompress.dll', please tell the package authors -
to check which versions of PostSharp have this issue the branch
dev/play-with-postsharp-versionswas created (also pushed to remote here) -
indeed the version
5.0.55doesn't throw this warning -
all later versions (the 6er line) have that issue