Inheritance security rules violated by type: 'SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSourceDesigner2' for DataSource

Posts   
 
    
ansu
User
Posts: 4
Joined: 17-Oct-2017
# Posted on: 17-Oct-2017 15:22:56   

After upgrading my project from version 5.2.3 -> 5.3.0 I got this weird error:

Inheritance security rules violated by type: 'SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSourceDesigner2'

I'm fighting with this 2 days and I created new project for testing purpose where I simulate that error - you can find projects here: https://ufile.io/iwnii - not working 5.3.0 https://ufile.io/blxq1 - working 5.2.3

My UI is WebForm with .net framework 4.5.2

Control for binding is regular asp dropdownlist but in my real application is Devexpress ASPxGridView


<asp:DropDownList id="CustomersDropDownList" runat="server" DataSourceID="CustomerDataSource" DataValueField="Id" DataTextField="Name"></asp:DropDownList>

DataSource looks like this:


<llblgenpro:LLBLGenProDataSource2 ID="CustomerDataSource"
                                          runat="server"
                                          AdapterTypeName="TestProjectDb.DatabaseSpecific.DataAccessAdapter, TestProjectDbDBSpecific"
                                          DataContainerType="EntityCollection"
                                          EntityFactoryTypeName="TestProjectDb.FactoryClasses.CustomerEntityFactory, TestProjectDb"
                                          CacheLocation="Session" AllowDuplicates="False" LivePersistence="False" OnPerformSelect="CustomerDataSource_OnPerformSelectDataSource_PerformSelect"></llblgenpro:LLBLGenProDataSource2>

And here is SQL for DB:


GO
CREATE DATABASE [Test1];
GO
USE [Test1]
GO
CREATE TABLE [dbo].[Customer](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [Name] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED 
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET IDENTITY_INSERT [dbo].[Customer] ON 

GO
INSERT [dbo].[Customer] ([Id], [Name]) VALUES (1, N'Tonco')
GO
INSERT [dbo].[Customer] ([Id], [Name]) VALUES (2, N'Marek')
GO
SET IDENTITY_INSERT [dbo].[Customer] OFF
GO

When I did nuget updates to version 5.3.0 and I also tried hotfix from prereleases above error appears.

Any idea. Thanks

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 17-Oct-2017 22:14:42   

Could you please provide the stack trace of the error?

ansu
User
Posts: 4
Joined: 17-Oct-2017
# Posted on: 18-Oct-2017 08:53:01   

Because it fails during application start. Here is how I catched that exception.

protected void Application_Error(object sender, EventArgs e)
{
            Exception ex = Server.GetLastError();
}

This is stacktrace from it:

at System.Web.Compilation.AssemblyBuilder.AddBuildProvider(BuildProvider buildProvider)\r\n   
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()\r\n  
 at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()\r\n   
 at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)\r\n   
 at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, 
 Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)\r\n   
 at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, 
 Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)\r\n   
 at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, 
 Boolean allowCrossApp, Boolean throwIfNotFound)\r\n   at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(
 VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)\r\n   
 at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)\r\n   
 at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path)\r\n   
 at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()\r\n   
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

And here is inner exception:

Inheritance security rules violated by type: 'SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSourceDesigner2'.
 Derived types must either match the security accessibility of the base type or be less accessible.

Stacktrace from inner exception:

at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)\r\n  
 at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)\r\n   
 at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType 
 attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)\r\n  
 at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)\r\n   
 at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)\r\n  
 at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectGetAttributes(Type type)\r\n   
 at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetAttributes()\r\n   
 at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetAttributes()\r\n  
 at System.ComponentModel.TypeDescriptor.GetAttributes(Type componentType)\r\n  
 at System.Web.Compilation.BaseTemplateCodeDomTreeGenerator.BuildBuildMethod(ControlBuilder builder, Boolean fTemplate, Boolean fInTemplate, 
 Boolean topLevelControlInTemplate, PropertyEntry pse, Boolean fControlSkin)\r\n   
 at System.Web.Compilation.BaseTemplateCodeDomTreeGenerator.BuildSourceDataTreeFromBuilder(ControlBuilder builder, Boolean fInTemplate, Boolean
 topLevelControlInTemplate, PropertyEntry pse)\r\n   at 
 System.Web.Compilation.BaseTemplateCodeDomTreeGenerator.BuildSourceDataTreeFromBuilder(ControlBuilder builder, Boolean fInTemplate, 
 Boolean topLevelControlInTemplate, PropertyEntry pse)\r\n   
 at System.Web.Compilation.BaseTemplateCodeDomTreeGenerator.BuildSourceDataTreeFromBuilder(ControlBuilder builder, Boolean fInTemplate,
 Boolean topLevelControlInTemplate, PropertyEntry pse)\r\n   
 at System.Web.Compilation.TemplateControlCodeDomTreeGenerator.BuildMiscClassMembers()\r\n  
 at System.Web.Compilation.PageCodeDomTreeGenerator.BuildMiscClassMembers()\r\n   
 at System.Web.Compilation.BaseCodeDomTreeGenerator.BuildSourceDataTree()\r\n   
 at System.Web.Compilation.BaseCodeDomTreeGenerator.GetCodeDomTree(CodeDomProvider codeDomProvider, StringResourceBuilder stringResourceBuilder,
 VirtualPath virtualPath)\r\n   at System.Web.Compilation.BaseTemplateBuildProvider.GenerateCode(AssemblyBuilder assemblyBuilder)\r\n   
 at System.Web.Compilation.AssemblyBuilder.AddBuildProvider(BuildProvider buildProvider)

You can also create own project 5.2.3 and try to upgrade to 5.3.0 if you don't want to use above project from links. Make sure you are trying it with Webform where is used SD.LLBLGen.Pro.ORMSupportClasses.Web dll.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 18-Oct-2017 09:43:54   

We'll look into it.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 18-Oct-2017 11:19:59   

Reproduced. At first I had no idea what it could be. Compared the two web dlls on attributes to see what it was, and I saw the v5.3.0 one is compiled against .net v4.5.2 and that requires [assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)] which wasn't added.

After adding that and referencing that dll in your test app, it works.

We'll upload a hotfix within an hour.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 18-Oct-2017 11:53:16   

Please update to v5.1.3 hotfix of today, october 18th. That should fix your issue. Sorry for this inconvenience. It's a lame issue, and by moving to .net 4.5.2 from .net 3.5 we should have added that attribute to the web dll which we overlooked (we did add it to the ormsupportclasses some years ago but we had forgotten all about it )

Frans Bouma | Lead developer LLBLGen Pro
ansu
User
Posts: 4
Joined: 17-Oct-2017
# Posted on: 18-Oct-2017 15:05:35   

MEGA, in my test project that hotfix works. I will try it also in my real project. Thx