I'm attempting to develop a simple aspect - InformationAttribute
- based on ScalarConstraint
whose purpose is to output/add to the Visual Studio error list at compile time a message. I'm wanting specifically an informational message rather than a warning, such that treating warnings as errors, etc., won't cause the compile to break; these messages are intended for, for example, reminding developers that using certain aspects in a project requires the use of a particular PostSharp plugin library, or that certain tests require particular external preconditions.
In theory, this should be simple, especially as I already have a working WarningAttribute
that does the same job as a warning. However, simply changing the SeverityType
in the call to Message.Write
, thus:
public override void ValidateCode (object target)
{
Message.Write (MessageLocation.Of (target),
SeverityType.ImportantInfo
"WA001",
this.reason) ;
}
Doesn't work, even though the PostSharp documentation states that messages written at SeverityType.ImportantInfo
are shown in Visual Studio's Error List under Messages. I can confirm that, when msbuild
is invoked from the command line, these messages are output to the console, but they don't show up in VS when the build is run from there.
I haven't found a good line of attack so far, or anyone having similar issues, unfortunately; has anyone resolved this or has a good approach to take to resolving it?
I confirm this feature is broken and we don't know yet which part of the pipeline is to blame - PostSharp or Visual Studio.
You have two options: emit a warning, or emit a tooltip using IWeavingSymbolsService
. You can get this interface through `PostSharpEnvironment.CurrentProject.GetService.
I created a bug report and we'll see if we can fix or if we will need to fix the documentation.