Upgrading Report applications to 4.0
Posted
Mon, Apr 19 2010 16:25
by
bill
I’ve been testing out upgrading some VS 2008 applications to 2010, but hit some MAJOR issues with projects that use Microsoft Reporting. I had reports that usually took seconds now take over a minute; and navigating via the document map was painfully slow as well: over 10 seconds compared to less than a second in the old version. I looked and looked and couldn’t find the cause. Strangely enough using the old report viewer worked well enough at runtime but had no design time support in VS 2010.
Then I stumbled across a post in Brian Hartman’s blog about changes to CAS in 4.0 and the effect on the report viewer. I didn’t think that could account for such a huge performance difference, but as I didn’t have anything else left to go on, I thought I’d try running the app using the new viewer compiled against .NET 3.5. As soon as I did that it worked just like it use to: the performance issues had disappeared. That meant it wasn’t the new viewer that was causing the issues as such, it was CAS.
So the next thing I did was compile the project against .NET 4.0 and sure enough the performance problem was back. I then opened up the config file and added the NetFx40_LegacySecurityPolicy element:
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime
Now it all works nicely; performance problems fixed.
So if you have troubles with local reports when upgrading to .NET 4.0, then trying adding the NetFx40_LegacySecurityPolicy element to your app.config.