| Severity | Fatal |
| Reported by | PostSharp |
| Message | Unhandled exception (<Host>): <Exception> |
Cause
PostSharp reports problems in your code with messages that explain them. When an exception that PostSharp did not expect stops the processing of the project instead, PostSharp catches it, reports PS0099, and the build fails. <Host> identifies the PostSharp process: its executable, the version of PostSharp, the version of the .NET runtime, and the processor architecture. <Exception> is the full text of the exception, with its stack trace and, when PostSharp has it, what PostSharp was doing when it happened.
An unhandled exception is usually a bug of PostSharp. It can also come from code of your own that runs at build time, such as the build-time methods of an aspect, or from a configuration that PostSharp does not check, as LA0021 shows. PostSharp also records a crash report, which it sends only after you agree.
This message is reported only when PostSharp fails unexpectedly, so no example can show it.
Resolution
- Read the stack trace in
<Exception>. When it goes through a method of your own code, such as a build-time method of an aspect, fix that method. Look also at the messages that PostSharp reported before PS0099: they may explain the failure. - Rebuild the project after deleting its
objfolder, to rule out stale intermediate files. - Check that you use the latest build of your version of PostSharp: the problem may already be fixed.
- To inspect the exception in a debugger, set the
PostSharpAttachDebuggerOnExceptionenvironment variable to any value, as Well-Known Environment Variables describes, and rebuild: PostSharp starts the debugger when it reports the exception. See also Debugging Build-Time Logic. - Otherwise, report the problem to the PostSharp support team, at https://www.postsharp.net/support, with the full text of the message, the build log, and if possible a project that reproduces it.
See Also
Other Resources
Debugging Build-Time Logic
Well-Known Environment Variables
Well-Known MSBuild Properties