Search code examples
c#postsharp

Why is PostSharp causing my project build to fail?


I am working on a unit testing project. This project has roughly 2600 test classes with an average of 15 unit tests per class. I'm not sure how many more classes I need to add to this project to recreate the error mentioned below, but I do know that adding a large amount (I tried 500) of files to the project is directly related to it. If I remove some files, I am able to build.

Compilation errors

unknown_location error PS0034: PostSharp: ILASM exited with return code 255. Tool output:

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

What is causing this to happen?

Edit: It might be important to note that that the test project does not use the custom PostSharp attribute directly. In other words, in none of the test classes do I have a using directive for a PostSharp dll. They are, however, used in the classes that the tests are testing.


Solution

  • Generally, to debug ILASM errors, I need at least to see the ILASM output. It must have printed some better error message. If you don't see it, try to build from the command line using MSBuild. The error message should help you to understand what the cause could be and to create a repro case, then submit it to our issue tracker.

    If you say that your project does not have aspects (even indirectly), you may simply skyp PostSharp for that project by including the compilation symbol "SkipPostSharp".