Search code examples
c#reportviewerpostsharp

Postsharp causes error when using Microsoft Report viewer


in my project I use two different versions of MicrosoftReportViewer (Version 9 and 10) and declare them by extern alias.

It seems like PostSharp causes a problem at compiletime that leads to an error at runtime.

Here is the error when I try to show a report:

Method not found: "Microsoft.Reporting.WebForms.ReportDataSourceCollection Microsoft.Reporting.WebForms.LocalReport.get_DataSources()".

If I deactivate PostSharp for runtime, the error is still there but if I deactivate PostSharp at all, so even for compiling, the report works fine.

Here is how I apply my aspects:

[assembly: ClickLogger("Click Events", AttributeTargetMembers = "*Click", AttributePriority = 1)]
[assembly: ParamValueChangedLogger("Value changed events", AttributeTargetMembers = "*ValueChanged", AttributePriority = 1)]
[assembly: ParamValueChangedLogger("Value changed events", AttributeTargetMembers = "*CellValueChanged", AttributeExclude = true, AttributePriority = 2)]
[assembly: CellValueChangedLogger("Cell value changed events", AttributeTargetMembers = "*CellValueChanged", AttributePriority = 1)]
[assembly: DataAdapterLogger("Data Adapter call events", AttributeTargetTypes = "*.Data*", AttributeTargetMembers = "get_Adapter", AttributePriority = 1)]
[assembly: DataAdapterLogger("Data Adapter call events", AttributeTargetMembers = "SaveToDB", AttributeExclude = true, AttributePriority = 2)]

Anyone ever had this error or an idea what to do here?

If you need further information feel free to ask.

Thanks in advance for your time and help.


Solution

  • This is likely a bug of PostSharp. The best thing to do is to report it to http://www.sharpcrafters.com/forum and attach a simple project reproducing the issue.