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

avatar's Avatar

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.

Thoughts?

Alistair

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

    PostSharp Technologies's Avatar

    Hello,

    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,
    -tony

  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.)

    Thanks,

    Alistair

  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,
    -tony

  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?

    Thanks,

    Alistair

  7. Support Staff 5 Posted by PostSharp Techn... on 01 Nov, 2017 11:34 AM

    PostSharp Technologies's Avatar

    Hello,

    the bug #15565 has been fixed in the current release of PostSharp 5.0.37.

    Should you need further help with this issue, don't hesitate to re-open this discussion.

    Best regards,
    -tony

  8. PostSharp Technologies closed this discussion on 01 Nov, 2017 11:34 AM.

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

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