Build error when using PostSharp with .NET Standard 2.0 project

avatar's Avatar


24 Jun, 2017 06:14 AM

I'm getting a build error whenever I try to use PostSharp with a .NET Standard 2.0 project (Visual Studio 2017/15.3 preview, .NET Core 2 preview, PostSharp; it doesn't occur when compiling after the PostSharp package is added to the project if no aspects are used in it, but as soon as any aspects are added to the project, it does.

Error is as below:

1>------ Build started: Project: ClassLibrary1, Configuration: Debug Any CPU ------
1>C:\Users\avatar\.nuget\packages\postsharp\5.0.26-rc\build\PostSharp.targets(329,5): error PS0099: Unhandled exception (, postsharp-net40-x86-srv.exe, CLR 4.0.30319.461268, Release): System.NullReferenceException: Object reference not set to an instance of an object.
1>C:\Users\avatar\.nuget\packages\postsharp\5.0.26-rc\build\PostSharp.targets(329,5): error PS0099:    at PostSharp.Sdk.Extensibility.Project.Execute()
1>C:\Users\avatar\.nuget\packages\postsharp\5.0.26-rc\build\PostSharp.targets(329,5): error PS0099:    at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
1>C:\Users\avatar\.nuget\packages\postsharp\5.0.26-rc\build\PostSharp.targets(329,5): error PS0099:    at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation).
1>Done building project "ClassLibrary1.csproj" -- FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

...and minimal reproduction project attached.

(I realize this is an issue using PostSharp against preview-level products, but I'm hoping that since they're due for release this quarter, y'all're already considering problem reports against it... :D )



  1. Support Staff 1 Posted by PostSharp Techn... on 26 Jun, 2017 02:08 PM

    PostSharp Technologies's Avatar


    Thank you for reporting this error to us. We will be adding support for .NET Standard 2.0 after PostSharp 5.0 RTM is released and this early feedback is very important for us. We will get back to you once we learn more about the issue.

    (filed as internal issue #15200)


  2. Support Staff 2 Posted by PostSharp Techn... on 21 Jul, 2017 12:11 PM

    PostSharp Technologies's Avatar


    We're closing the ticket for now as the bug has been internally filed as issue #15200. We will contact you as soon as the bug fix has been released.

    For more details on our support policies and prioritization of bug fixes, please visit

    PostSharp Team

  3. PostSharp Technologies closed this discussion on 21 Jul, 2017 12:11 PM.

  4. PostSharp Technologies re-opened this discussion on 19 Feb, 2018 04:17 PM

  5. Support Staff 3 Posted by PostSharp Techn... on 19 Feb, 2018 04:17 PM

    PostSharp Technologies's Avatar

    Hello, this bug has been fixed in PostSharp 5.0. Please read this post for more information about .NET Core and .NET Standard support:

    We are going to close this request as we believe it was solved. Please feel free to reopen the discussion if you need more help.

    Best regards,

  6. PostSharp Technologies closed this discussion on 19 Feb, 2018 04:17 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? 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