Open sandboxFocusImprove this doc

PS0122: Details of an Aspect Serialization Failure

Severity Information
Reported by PostSharp
Message Details of the previous error or warning:\n<Exception>

Cause

PostSharp serializes the aspect instances into a resource of the assembly at build time. When the serializer throws an exception, PostSharp reports the error LA0001, whose message gives only the message of the exception. It then reports PS0122, an informational message, whose <Exception> is the complete exception: its type, its message, its inner exceptions and its stack trace. PS0122 is not an error by itself: the build fails because of LA0001.

PostSharp logs PS0122 as a critical message of MSBuild, so the build log shows it after LA0001 even at the minimal verbosity.

The test framework of the examples records only warnings and errors, so no example can show this message. The example of LA0001 reports it too.

Resolution

Resolve LA0001, which PS0122 accompanies: make every field of the aspects serializable, or exclude it from serialization.

Use the details of PS0122 when the message of LA0001 is not enough:

  • The type of the exception and its inner exceptions show whether the serializer could not find a serializer for a type, or whether your own serialization code failed.
  • The stack trace shows which serializer, and which of your types, threw the exception.

See Also

Reference

PSerializableAttribute

Other Resources

Understanding Aspect Serialization