PortableSerializationException using an (aspected) type from a .NET Standard 2.0 assembly in a .NET Framework 4.7 assembly

avatar's Avatar


11 Oct, 2017 04:33 PM

The type in question is annotated with the [Actor] attribute. As soon as an instance is constructed, a nested TypeInitializationException is thrown, whose innermost exception is a PortableSerializationException with the message "Cannot find a serializer for type 'PostSharp.Patterns.Threading.DispatchedAttribute+DispatchedMethodAspect".

Notably, this does not happen using the same .NET Standard 2.0 assembly and constructing the same instance from a .NET Core 2.0 assembly; that works as expected.



  1. Support Staff 1 Posted by PostSharp Techn... on 12 Oct, 2017 08:10 AM

    PostSharp Technologies's Avatar


    thank you for reporting this, it is a bug and we are going to fix it. We have filed it internally as issue #15565.

    To unblock your development in the meanwhile, you can set your library to compile for .NET Framework 4.7. (Either net47 or netstandard2.0;net47 if you need to cosume it on .NET Core as well.)

    As of our standard plan, the bug fix would be released in 2 weeks since now. Since the workaround provided unblocks development, but probably not publishing of your project, is the 2 weeks period acceptable for you?

    Best regards,

  2. 2 Posted by avatar on 13 Oct, 2017 06:01 AM

    avatar's Avatar

    Thanks for the quick update.

    As for the two week period, we can work with that. (Not that we wouldn't appreciate an earlier fix if one happened, admittedly, since we'd like to throw some test builds over the wall to our customers as soon as we can - but it's not an absolute necessity for us.)



  3. Support Staff 3 Posted by PostSharp Techn... on 13 Oct, 2017 08:07 AM

    PostSharp Technologies's Avatar

    OK, thank you.

    We're closing the ticket for now as the bug has been internally filed as issue #15565. 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 https://www.postsharp.net/support/policies.

    Best regards,

  4. PostSharp Technologies closed this discussion on 13 Oct, 2017 08:07 AM.

  5. avatar re-opened this discussion on 16 Oct, 2017 02:25 PM

  6. 4 Posted by avatar on 16 Oct, 2017 02:25 PM

    avatar's Avatar

    This comment was split into a new discussion: TypeLoadException using an [Synchronized] type from a .NET Standard 2.0 assembly in a .NET Framework 4.7 assembly

    FYI, we get a similar nested TypeInitializationException calling from a .NET Standard 2.0 assembly into a .NET Framework 4.7 one. (Although in this case, the innermost exception is a TypeLoadException: "Could not load type 'SynchronizationContextEnhancements from assembly PostSharp.Patterns.Threading" - the class being called into in this case being Synchronized, rather than an Actor.)

    Is this another manifestation of the same bug, and thus have the same fix?



Reply to this discussion

Internal reply

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

Attaching KB article:


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


? 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