For those who play around with custom assemblies in SQL Reporting Services, it’s pretty common knowledge that it is not necessary to add a <CodeGroup> element for your custom assembly in RSPreviewPolicy.config in order to use it while previewing your report in BIDS. Essentially, in 2005 if you drop a custom assembly into \PrivateAssemblies (and maybe elsewhere, I haven’t checked), DevEnv.exe gives it FullTrust in BIDS preview even if you don’t add a <CodeGroup> for it like BOL tells you to. I have to admit that I tell all my customers to make sure to add this entry as a best practice, but I rarely do it myself 🙂
Well, it looks like that habit is about to change. I was trying to reproduce a problem in 2008 for a customer today and they use custom assemblies. I did the standard rssrvpolicy.config mods on my server, dropped the assemblies in question into ReportServer\Bin and \PrivateAssemblies and tried to preview the report in BIDS. I got this error message:
Failed to load expression host assembly. Details: The type initializer for “Some.Assembly.Name.Is.Here” threw an exception.
I spent a good 45 minutes double-checking my work and then for the hell of it went ahead and added a CodeGroup for each of the 3 assemblies I was working with. My report immediately started previewing correctly in BIDS.
So, unless I’m just working with an odd build of SSRS 2008, it looks like we’re all going to have to do a little bit more work in the future when working with custom assemblies.