PostSharp Tools for Visual Studio 2017 (5.0.17) bug in Visual Studio 2017 RC4 (15.0.26206.0)

dimitri's Avatar


10 Feb, 2017 01:25 AM

When adding [NotifyPropertyChanged] to a brand new Class Library Project I get the following error at compile time

Severity Code Description Project File Line Suppression State
Error An unexpected exception occurred when executing user code: System.MethodAccessException: Attempt by method 'PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.CompileTimeValidate(System.Type)' to access method 'PostSharp.Reflection.ReflectionApiWrapper.GetBaseType(System.Type)' failed.
   at PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.CompileTimeValidate(Type type)
   at PostSharp.Aspects.TypeLevelAspect.CompileTimeValidate(Object target)
   at PostSharp.Sdk.AspectWeaver.AspectWeaverInstance.^pCdttYEs.^Q7McNsOl()
   at PostSharp.Sdk.Utilities.ExceptionHelper.ExecuteUserCode[T](MessageLocation messageLocation, Func`1 userCode, Type[] acceptableExceptions). ClassLibrary1

The project has nothing more than the default class1.cs

    public class Class1

  1. Support Staff 1 Posted by PostSharp Techn... on 10 Feb, 2017 07:07 PM

    PostSharp Technologies's Avatar


    Thank you for reporting this issue. What is the target framework of your project?
    And, just to confirm, the version of PostSharp NuGet package installed into your project is also 5.0.17?


  2. 2 Posted by dimitri on 11 Feb, 2017 01:08 PM

    dimitri's Avatar

    Target framework for the project is 4.6.1 and the nuget is 5.0.17-preview.

    [cid:[email blocked]]

  3. Support Staff 3 Posted by PostSharp Techn... on 14 Feb, 2017 04:37 PM

    PostSharp Technologies's Avatar


    this is a packaging bug, the net46 version of the PostSharp.Patterns.Common is missing some attributes. You can do a workaround by deleting net46 folder from the package directory (because PostSharp is trying to load it for execution).

    We will be working on a fix.

    (internal issue #14690)


  4. 4 Posted by dimitri on 15 Feb, 2017 12:54 AM

    dimitri's Avatar

    Hello Daniel,

    The fix worked for the simple project but when I tried to update my main project using the same solution I was getting many more errors.

    I have a deadline to meet so I reverted to VS 2015 and PS

    I will try again with a release candidate of Postsharp when it will come.

    Thank you for your assistance,


  5. Support Staff 5 Posted by PostSharp Techn... on 28 Feb, 2017 02:41 PM

    PostSharp Technologies's Avatar


    We're closing the ticket for now as the bug has been internally filed as issue #14690. 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

  6. PostSharp Technologies closed this discussion on 28 Feb, 2017 02:41 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