The "PostSharp21" task failed unexpectedly.

richard's Avatar

richard

05 Oct, 2012 07:27 AM

When Builden i randomly gets an axeception lime this. Sometimes it helps to rebuild all. Sometimes restart visual studio.
We are using visual stuid 2012. It happens both on web projects and on standard dlls.
Error 29 The "PostSharp21" task failed unexpectedly.

System.MissingMethodException: Method not found: 'System.Threading.EventWaitHandle PostSharp.Pipe.PipeEndpoint.GetPipeAvailableWaitHandle(System.String, System.String, System.String)'.
at PostSharp.MSBuild.PostSharp21.ExecutePipeClient() at PostSharp.MSBuild.PostSharp21.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext() C:\Program Files (x86)\PostSharp 2.1\PostSharp.targets 305 5 TooBookBack

  1. Support Staff 1 Posted by sharpcrafters on 09 Oct, 2012 07:32 AM

    sharpcrafters's Avatar

    This may be a version conflict. Consider the following possibilities:

    • Your installation of PostSharp may be "dirty", with several versions mixed.
    • Assembly PostSharp.Pipe may be in GAC (it should not).
    • There may be several projects in your solution, each bound to a different version of the NuGet package.
    • The NuGet package could be of a different version than the one installed with the installer.
    • There may be just a caching issue with MSBuild. Try killing all MSBuild background processes.

    We are working to prevent these versioning issues. The latest version, for instance, includes the version number directly in the file name. However, there may still be a problem with the assembly PostSharp.Pipe.

    -gael

  2. sharpcrafters closed this discussion on 09 Oct, 2012 07:32 AM.

  3. richard re-opened this discussion on 09 Oct, 2012 07:45 AM

  4. 2 Posted by richard on 09 Oct, 2012 07:45 AM

    richard's Avatar

    Hi,

    Yes, i belive it was "dirty".
    Do each developer need to have Postsharp installed or could it be easier to manage it by using NuGet packages for the solution instead.
    Now I used the Postsharp 2.1 HQ and converted all the projects.
    That lead to the problem with one of the developers not having a 64 bit machinge hence the folder to posthsarp.targets wasn't "C:\Program Files (x86)\PostSharp 2.1" but instead just "C:\Program\PostSharp 2.1 " We created a folder on his machine with the same path.
    But that will lead to truouble with updates.
    So should we instead use NuGet which we can easier maintain at a higher leveler without much installations issues on each dev machine.

    /Richard

    Richard Lindeberg   -  2Book AB
    [email blocked]- direct: +46 8 470 37 93
    support: +46 8 735 84 00 - ***@***
    www.2book.se

  5. Support Staff 3 Posted by sharpcrafters on 09 Oct, 2012 07:48 AM

    sharpcrafters's Avatar

    Both Nuget and setup are supported in 2.1, but there used to be conflicts because of MSBuild and VS caching the libraries. We are in the process of solving these conflicts.

    I know about the x64 directory issue but so far I have not been able to reproduce it. I think using a junction instead of copy would avoid issues during updates.

  6. 4 Posted by michael.freidge... on 17 Oct, 2012 08:28 PM

    michael.freidgeim's Avatar

    Gael,

    The latest version, for instance, includes the version number directly in the file name.

    Technically version specific Names will allow "side by side" support of multiple PostSharp versions. However having multiple folders and versions, that differ only in revisions or build number, is a mess. It would be good to have a process to update references of all projects in the solution to the latest version and possibly delete old ones.
    I have 3 folders in my solution:
    packages\PostSharp.2.1.6.14
    packages\PostSharp.2.1.7.6
    packages\PostSharp.2.1.7.15
    Thre is no easy way to determine, is any project still refer to old version, or all are using the latest and previous folders can be removed.

  7. Support Staff 5 Posted by sharpcrafters on 19 Oct, 2012 01:34 PM

    sharpcrafters's Avatar

    The update and maintenance tools you are mentioning is NuGet itself. You can use NuGet to manage packages at solution level. In PostSharp 3.0, NuGet will be the only way of deployment.

  8. 6 Posted by Shane Oborn on 16 Mar, 2013 07:27 PM

    Shane Oborn's Avatar

    Has anything else been found out about this? I've spent 3 hours on a Saturday trying to get our flipping solution compiling again, and I can't get it to work. This is extremely frustrating. There is not another NuGet package that causes this problem, and its the only one we've actually had to pay for that we use. Completely unacceptable in my opinion.

    Please help out. I've removed all references to PostSharp, which of course then breaks the compile because we have code actually using PostSharp. But this does nothing anyway, once we put the references back.

    It only works if I add a PostSharp referenc to EVERY project in our solution (we probably have 15 projects in the solution, but only 4 that actually use PostSharp). This is an unacceptable hack. There is no reason I should have to reference PostSharp in every project obviously. But its the only thing I've found that will allow the solution to compile so far.

    There MUST be a cache somewhere we can delete. PostSharp is remembering something it shouldn't. I've deleted all bin folders, project "obj" folders, the postsharp references, entries from packages.config, etc. etc... and it still throws this flipping error. And it used to only mention the latest version (*.29), but now I'm getting references in the errors to (*.28) and I don't even have this on by computer anymore!

  9. 7 Posted by Shane Oborn on 16 Mar, 2013 08:48 PM

    Shane Oborn's Avatar

    As far as I can tell after 5 hours of troubleshooting, it appears that you have to add PostSharp to every assembly that uses any other assembly that has PostSharp included in it.

    So if I have "Assembly-A" that uses PostSharp, and then "Assembly-B" adds "Assembly-A" as a reference, then even if "Assembly-B" doesn't use PostSharp at all, it still needs the PostSharp reference.

    This is crazy. Can anyone confirm that this is true or not? DId something change with build *.29?

  10. 8 Posted by Shane Oborn on 16 Mar, 2013 09:24 PM

    Shane Oborn's Avatar

    After 6 hours, I got past it. For me anyway, apparently I had a *.28 version of PostSharp in my Program Files folder, but *.29 from nuget.

    Extremely frustrating. I thought it was using the version that nuget puts on my box, and in some cases it does. So i have no idea why it would use nuget's version sometimes, and the program files version in others (PostSharp server).

    But I finally saw in my task manager that sometimes it was .28 server, and other times it was .29 server.

    Wow. Anyway, got past it. When you uninstall the program files version, it will ask if you want to install some VS integration tool the first time you run, but i'm assuming its best to just say "no" to that because it won't get updated when nuget gets a new version down the road.

    Yuck.

  11. 9 Posted by michael.freidge... on 17 Mar, 2013 12:50 AM

    michael.freidgeim's Avatar

    @Shane,

    I also had an  "PostSharp21" task failed unexpectedly. error MSB4018: System.TimeoutException: Timeout when waiting for pipe"
    ( http://support.sharpcrafters.com/discussions/problems/482-no-subject ) and to work-around I've added postsharp to all (50+) projects in the solution. The cause was the same - different versions of postSharp compete with each other. 

    Gael expected that error "was solved in a later build" ( his post 14 Jan 2013), but it looks like it is still the issue.
    I am looking forward to v.3., that hopefully will not have the issue.

  12. Support Staff 10 Posted by sharpcrafters on 18 Mar, 2013 10:25 AM

    sharpcrafters's Avatar

    Hello,

    It is quite embarrassing to me that you had to spend so much time troubleshooting. I know the issue is due to mixed versions of PostSharp in the same solution. I added some logging to MSBuild output to help me diagnosing the issue. However, I was not able to reproduce the issue on our environment, so I cannot confirm the issue has been solved. I cannot confirm that PostSharp 3 does not have this issue.

    If you are getting this issue, please produce a build log using the command msbuild /v:diag > msbuild.log and send it to me. I could also help you through desktop sharing if needed.

    Sorry again. I hope we'll be able to understand the problem wit your help.

    -gael

  13. 11 Posted by Shane Oborn on 18 Mar, 2013 03:30 PM

    Shane Oborn's Avatar

    I appreciate the help. And I didn't mean to come across too harsh, but it was an extremely frustrating Saturday and after spending a lot of money on this plugin, it sort of added to the frustration. :)

    But we absolutely love PostSharp, don't get me wrong!

    Anyway, if you're trying to recreate, I think I can help you. What I ended up doing to break this problem down was to tear it apart to bare essentials. And I believe this will recreate it on your end. Let me know if not.

    1. Install PostSharp (install from your website) for version *.28.
    2. Create two class library projects in a new solution.
    3. Now use NuGet, to add PostSharp version *.29 to one of your class library projects.
    4. Now, in the class library project that DOES NOT HAVE PostSharp added to it, reference the project that DOES have PostSharp.
    5. Compile solution.

    I think error should happen here on compile.

    I was not able to validate these steps, because I do not have the PostSharp *.28 install anymore. But I can tell you that this was the state of my server when the problem was happening. Removing/uninstalling PostSharp *.28 from Program Files (x86) solved my problem.

    From what I could see, for some reason, PostSharp *.28 was being used for the project that did NOT have a PostSharp reference (maybe because it was referencing a project that DID use PostSharp??), and PostSharp *.29 was being used for the project that had the NuGet *.29 reference.

    Let me know if this worked for you.

  14. Support Staff 12 Posted by sharpcrafters on 19 Mar, 2013 10:23 AM

    sharpcrafters's Avatar

    Thank you. I could reproduce the issue and identify the cause. The timeout will occur only if the compiler service of another version is running. This can happen if you compile, in a time span of a few minutes, projects with different versions of PostSharp. I am testing a fix and will publish it soon.

    -gael

  15. Support Staff 13 Posted by sharpcrafters on 19 Mar, 2013 07:30 PM

    sharpcrafters's Avatar

    The issue should be fixed from revision 2.1.7.30.

    It seems I introduced but while solving the original defect, and this new bug became observable only in the version number following the version in which I fixed the original defect. I hope PostSharp 2.1 is now fully side-by-side compatible with any version.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac