none
AddTrustedCodeModuleInCurrentAppDomain and Drillthrough reports RRS feed

  • Question

  • I have a drill through report working in local mode and all is good. The problem occurs when the user clicks the back button to go back to the parent report. The parent report references an assembly eg Foo.Bar.dll . When initially rendering the parent report Foo.Bar is added to the app domain with localReport.AddTrustedCodeModuleInCurrentAppDomain and the report renders. But when the user clicks back button on the drill through an exception is thrown complaining that Foo.Bar is not trusted.

    Microsoft.Reporting.WebForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: The report references the code module ‘Foo.Bar, Version=6.0.175.0, Culture=neutral, PublicKeyToken=null’, which is not a trusted assembly. 

    The solution is to handle the Back event and add the assembly to the parent report with another call to AddTrustedCodeModuleInCurrentAppDomain. But I am wondering why this is even necessary. The parent report already has it's data and is ready for rendering, but somehow has lost the knowledge that it is ok to run Foo.Bar. Is this by design? Is there something simple I am missing? Or is handling the Back event on the ReportViewer control the correct approach.

    Thanks,

    Dave


    • Edited by 2dave Thursday, January 10, 2013 5:37 PM
    Thursday, January 10, 2013 5:36 PM