I am having a problem with code that worked fine in .NET 2.0 but is giving this error under .Net 4.
Build (web): Inheritance security rules violated while overriding member: 'Controls.RelatedPosts.RenderControl(System.Web.UI.HtmlTextWriter)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
This is in DotNetBlogEngine. There were several other security demands in the code that .NET 4.0 doesn't seem to like. I followed some of the advice I found on blogs (and here) and got rid of all the other errors. But this one still eludes me.
The Main BlogEngine core dll
is not set for security demands any longer and is compiled for .NET 4.0 as well.
This error is in the website side attempting to use the dll
. There are controls that call a RenderControl
method taking an HtmlTextWriter
. Apparently the text writer now has some soft of security attributes set on it.
Each of the controls implements a custom interface ( public interface ICustomFilter
), there are no security permissions present or demands. The site is running full trust on my local dev machine.
Update:
I have tried the various settings under the security namespace in .NET 4 I read about here. I know this is a code access security change, but I don't understand the why behind it not working (or the error message).