Hi,
I get this exception when editing a language or when trying to generate localized version of pages or publish them (the process fails).
This seems to be related: http://www.dotnetnuke.com/tabid/795/forumid/77/postid/405843/scope/posts/default.aspx
This is a trace, including line numbers (this is a DNN 5.6.1):
DotNetNuke.Services.Exceptions.ModuleLoadException: Sequence contains more than one element --->
System.InvalidOperationException: Sequence contains more than one element at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source) at DotNetNuke.Entities.Modules.ModuleController.AddModulePermission(ModuleInfo& objModule, Int32 portalId, String roleName, PermissionInfo permission, String permissionKey) in C:\Builds\Maintenance\WorkingDirectory\Library\Entities\Modules\ModuleController.vb:line 108 at DotNetNuke.Entities.Modules.ModuleController.LocalizeModuleInternal(ModuleInfo sourceModule) in C:\Builds\Maintenance\WorkingDirectory\Library\Entities\Modules\ModuleController.vb:line 161 at DotNetNuke.Entities.Modules.ModuleController.LocalizeModule(ModuleInfo sourceModule, Locale locale) in C:\Builds\Maintenance\WorkingDirectory\Library\Entities\Modules\ModuleController.vb:line 1331 at DotNetNuke.Entities.Tabs.TabController.CreateLocalizedCopy(TabInfo originalTab, Locale locale) in C:\Builds\Maintenance\WorkingDirectory\Library\Entities\Tabs\TabController.vb:line 1154 at DotNetNuke.Modules.Admin.Languages.EditLanguage.cmdUpdate_Click(Object sender, EventArgs e) --- End of inner exception stack trace ---
ModuleController.vb:line 108 is this the red line here:
Private Sub AddModulePermission(ByRef objModule As ModuleInfo, ByVal portalId As Integer, ByVal roleName As String, ByVal permission As PermissionInfo, ByVal permissionKey As String)
Dim role As RoleInfo
Dim modulePermission As ModulePermissionInfo
Dim perm As ModulePermissionInfo
perm = objModule.ModulePermissions.Where(Function(tp) tp.RoleName = roleName AndAlso tp.PermissionKey = permissionKey).SingleOrDefault()
If permission IsNot Nothing AndAlso perm Is Nothing Then
perm = objModule.ModulePermissions.Where(Function(tp) tp.RoleName = roleName AndAlso tp.PermissionKey = permissionKey).SingleOrDefault()
modulePermission = New ModulePermissionInfo(permission ...
...
I thought this was related with something 'weird' about some module's permissions, and AddModulePermission() fails when is trying to copy them.
The exception happens because a singe result is expected, but instead of that, more than one 'row' is returned?
To test what happens (I can restart researching from a new clone of the site) I've deleted ALL rows from ModulePermission table. This error remains exactly the same.
So, this is not related with module's permissions, or is it? Is this then related with roles?
BTW, many people may say that LINQ is cool and how nice and readable it is. Maybe it's because I'm old, but I don't see this much readable. I prefer plain true SQL..
Does anybody know what this read line is really doing and why does it fail?
Any ideas will be much appreciated.
Thanks!
H