Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module 7.0.6 Fails after Upgrade to DNN 9.8.0 #229

Closed
djamell opened this issue Dec 21, 2020 · 41 comments · Fixed by #230
Closed

Module 7.0.6 Fails after Upgrade to DNN 9.8.0 #229

djamell opened this issue Dec 21, 2020 · 41 comments · Fixed by #230

Comments

@djamell
Copy link

djamell commented Dec 21, 2020

Describe the bug

After Upgrading from 9.7.2 to 9.0.8 the Events Module 7.0.6 fails to load. Module loaded and worked fine on DNN 9.7.2

To Reproduce

Loading any page with either the Events Module or the Latest Module results in an error.

Expected behavior

Module should load without error

Screenshots

If applicable, add screenshots to help explain your problem.

Error logAbsoluteURL:/Default.aspx

DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID:f6b6f0bb-ce24-4a5f-8ed2-f3c6bb75fb74
AssemblyVersion:
PortalId:-1
UserId:-1
TabId:-1
RawUrl:
Referrer:
UserAgent:
ExceptionHash:NS09lb/i4bKyc1saI0kTi2ZSvOs=
Message:Could not cast System.Collections.ArrayList to property ModuleLocationIDs of type System.Collections.ArrayList
StackTrace:
at DotNetNuke.Entities.Modules.Settings.SerializationManager.DotNetNuke.Abstractions.ISerializationManager.DeserializeProperty[T](T myObject, PropertyInfo property, String propertyValue, String serializer)
at DotNetNuke.Entities.Modules.Settings.SettingsRepository1.<>c__DisplayClass16_0.<Load>b__0(ParameterMapping mapping) at DotNetNuke.Collections.CollectionExtensions.ForEach[TType](IEnumerable1 source, Action1 action) at DotNetNuke.Entities.Modules.Settings.SettingsRepository1.Load(CacheItemArgs args)
at DotNetNuke.Common.Utilities.DataCache.GetCachedDataFromRuntimeCache(CacheItemArgs cacheItemArgs, CacheItemExpiredCallback cacheItemExpired)
InnerMessage:Could not cast System.Collections.ArrayList to System.Collections.ArrayList
InnerStackTrace:
at DotNetNuke.Entities.Modules.Settings.SerializationManager.DeserializeValue(String propertyValue, String serializer, Type destinationType)
at DotNetNuke.Entities.Modules.Settings.SerializationManager.DotNetNuke.Abstractions.ISerializationManager.DeserializeProperty[T](T myObject, PropertyInfo property, String propertyValue, String serializer)
Source:DotNetNuke
FileName:
FileLineNumber:0
FileColumnNumber:0
Method:
Server Name: martserver2

Additional context

Add any other context about the problem here.

@MaiklT
Copy link

MaiklT commented Dec 27, 2020

I can confirm this.

After installing the debug assemblies I got the following in the inner stack trace:

at Components.EventModuleSettings.CreateEventModuleSettings(Int32 moduleId, String localResourceFile) in C:\DDrive\Develop\GitHub\DNN.Events\Components\EventModuleSettings.cs:line 247
at Components.EventModuleSettings.GetEventModuleSettings(Int32 moduleID, String localResourceFile) in C:\DDrive\Develop\GitHub\DNN.Events\Components\EventModuleSettings.cs:line 101
at Components.EventBase.get_Settings() in C:\DDrive\Develop\GitHub\DNN.Events\Components\EventBase.cs:line 1378
at Components.EventBase.GetThemeSettings() in C:\DDrive\Develop\GitHub\DNN.Events\Components\EventBase.cs:line 475
at Components.EventBase.SetTheme(Panel ctlPnlTheme) in C:\DDrive\Develop\GitHub\DNN.Events\Components\EventBase.cs:line 422
at DotNetNuke.Modules.Events.Events.Page_Load(Object sender, EventArgs e) in C:\DDrive\Develop\GitHub\DNN.Events\Events.ascx.cs:line 591
at System.Web.UI.Control.OnLoad(EventArgs e)
[....]

It looks like that loading the theme causes the issue.

I tried uninstalling the module, and after re-installing it it worked fine, but I had to go back to 9.7.2 not to lose the events.

@EPTamminga
Copy link
Member

Something strange with the modulesettings?

@MaiklT
Copy link

MaiklT commented Dec 28, 2020

Nothing special, afair. Would a list of all ModuleSettings be helpful?

BTW: It happened on two different sites, both of them have an instance of the module (these are all sites that I have that use the module). There is no master calendar or anything. Both portals have only one language activated (de-AT),

I installed DNN 9.7.2 (blank site template) in a testing environment, activated de-AT and deactivated en-US. I installed the Core Resource Pack (de-AT), Events 07.00.06 and the de-AT resource pack. Then I placed an instance of the Event module on the start page. There were just a few settings to change to make it work (Email addresses, timezone - note: I did not change anything else!), then I added some events,

Then I upgraded to DNN 9.8.0 - and the error was there.

So it is easy to reproduce.

@james7342
Copy link

I didn't spend much time on it due to 9.8.0 being pretty new. When I tested I believe I got the same error. I restored the site back to 9.7.2 and really didn't do much troubleshooting.

@MaiklT
Copy link

MaiklT commented Dec 30, 2020

Just tried to upgrade a site from DNN 9.6.1 to 9.8.0 - same problem. Here I have a "master" calendar that includes three sub calendars. The only one that works is the sub-calendar that does not have a single event (lazy editor :-))

@MaiklT
Copy link

MaiklT commented Dec 30, 2020

Set up a DNN 9.7.2 website (blank template), just added the Events Module, I placed it on the start page, set the timezone and the email addresses and added an event. Upgraded to 9.8.0 -> Error. So this is no localization issue.

Did the same without adding an event, and without changing any setting (just went into settings, and clicked update). Then upgraded to DNN 9.8.0. No error, Could add an event as well.

@EPTamminga
Copy link
Member

The serialization in DNN980 has changed on several points from previous DNN versions causing a breaking error:

DotNetNuke.Entities.Modules.Settings.SerializationManager.DotNetNuke.Abstractions.ISerializationManager.DeserializeProperty[T](T myObject, PropertyInfo property, String propertyValue, String serializer)
at DotNetNuke.Entities.Modules.Settings.SettingsRepository1

I did not have time yet to see how this can be fixed.

@brewadmin
Copy link

I get the same error (Message:Could not cast System.Collections.ArrayList to property ModuleLocationIDs of type System.Collections.ArrayList
StackTrace:
at DotNetNuke.Entities.Modules.Settings.SerializationManager.DotNetNuke.Abstractions.ISerializationManager.DeserializeProperty[T](T myObject, PropertyInfo property, String propertyValue, String serializer) ... after upgrade to DNN 9.8.

@EPTamminga
Copy link
Member

@brewadmin Yes, I know, it is a result of the changed Settings routines in DNN980. I still have to see what has to be changed...

@brewadmin
Copy link

brewadmin commented Jan 11, 2021 via email

@blair260
Copy link

blair260 commented Jan 13, 2021

Has anyone discovered a fix for this? We had a ransomeware attack on our server and have been forced to upgrade to 9.8 and now the events module doesn't work. I've looked at the code, but I can't see the failure. Any thoughts on how to get this working?

@EPTamminga
Copy link
Member

I think the error is related to a change in DNN980 in serialization:
dnnsoftware/Dnn.Platform#4312
I did not find the time yet to dig deeper into the problem.

@james7342
Copy link

I was thinking it was more related to this change. dnnsoftware/Dnn.Platform#4087

But I could be wrong. I to tried looking at the code to see if I could figure it out. I don’t have a proper DNN development environment setup so was unable to follow the DNN source code. I was able to install the symbols and could see which lines of code being reported. That was about it though.

@EPTamminga
Copy link
Member

@james7342 I think you are right.

I will try to allocate some time tomorrow to have a serious look since the problem irritates me :-(

@bdukes
Copy link

bdukes commented Jan 14, 2021

The error is coming from the ModuleLocationIDs property in the settings, which is an ArrayList, but is marked as a ModuleSetting. Without a custom serializer specified, there's no way for this property to be serialized and deserialized correctly. I'm guessing that the error was silently ignored before the change in 9.8.0, but I don't see that it was doing anything useful with this field prior to 9.8.0. If you remove the ModuleSetting attribute, does that resolve the issue?

[ModuleSetting]
public ArrayList ModuleLocationIDs
{
get
{
if (ReferenceEquals(_moduleLocationIDs, null))
{
var arLoc = new ArrayList();
arLoc.Add(ModuleLocationID);
_moduleLocationIDs = arLoc;
}
return _moduleLocationIDs;
}
set { _moduleLocationIDs = value; }
}

@james7342
Copy link

james7342 commented Jan 15, 2021

That looks like it fixes it. I created a DNN 9.7.2 instance. Installed Events 7.0.6 and placed module on page. Changed some random settings and created a single test event. Upgraded to DNN 9.8.1 and verified the issue. Created a fork of the project and just commented out the line 414. Rebuilt the project and installed the module (Repair Installation). Loaded the page and the calendar loaded without error. Since I'm not an everyday developer and not sure what other possible issues might happen with this change I'll let someone smarter than me do the actual code change and commit. But playing with this in my little slice of the world appears to have resolved it. Looks like maybe this was just an errant line.

//[ModuleSetting]
public ArrayList ModuleLocationIDs
{
get
{
if (ReferenceEquals(_moduleLocationIDs, null))
{
var arLoc = new ArrayList();
arLoc.Add(ModuleLocationID);
_moduleLocationIDs = arLoc;
}
return _moduleLocationIDs;
}
set { _moduleLocationIDs = value; }
}

@EPTamminga
Copy link
Member

@bdukes Tnx for having a look. I need to see if the ModuleSettings is a result of VB,net->C# conversion some releases ago.
I know I had the idea to have a look 2 days ago, but time flies when you need to do "normal" work from home in Corona times...

@EPTamminga
Copy link
Member

EPTamminga commented Jan 15, 2021

I have looked into it somewhat further. The code is from serious time back.

The list of locations should be saved in the module settings since the module can limit the locations that are available for events in a particular module instance.

Commenting out the line [ModuleSettings] is not the solution (yes, it is the solution to circumvent the error, but does not enable saving the settings for location id's).

I have to look a bit further to make it without error.

Frustrating is that it did work correctly pre DNN980, the setting stored = a "System.Collections.Arraylist"

@bdukes
Copy link

bdukes commented Jan 15, 2021

@EPTamminga so you're saying that while it didn't error before DNN 9.8.0, it didn't store a meaningful value, right? So, it was never storing the list of IDs that you wanted it to store.

You have two options to get the serialization manager to handle a custom type like ArrayList. First, you can move it to a property which has the string value and parse it manually when you need it. This is the strategy used by the ModuleCategoryIDs setting:

public ArrayList ModuleCategoryIDs
{
get
{
if (ReferenceEquals(_moduleCategoryIDs, null))
{
var arCat = new ArrayList();
arCat.Add(ModuleCategoryID);
_moduleCategoryIDs = arCat;
}
return _moduleCategoryIDs;
}
set { _moduleCategoryIDs = value; }
}
[ModuleSetting(ParameterName = "ModuleCategoryIds")]
public string ModuleCategoryIdsList
{
get { return string.Join(";", ModuleCategoryIDs ?? new ArrayList()); }
set
{
ModuleCategoryIDs = !string.IsNullOrWhiteSpace(value)
? new ArrayList(
value.Split(new[] {";"}, StringSplitOptions.RemoveEmptyEntries)
.Select(arg => arg)
.ToArray())
: new ArrayList();
}
}

The second option it to specify a custom serializer in the ModuleSetting attribute. The Serializer property of the attribute can be set to the name of a type that implements ISettingsSerializer<ArrayList>, and then that class will be called to translate to and from string when interacting with the settings table.

@EPTamminga
Copy link
Member

@bdukes Tnx for the suggestions.

What is was trying to say that it did work before DNN980. I will implement the change like the CategoryID's.

@blair260
Copy link

Thanks guys - good stuff here and that makes sense. I appreciate everyone jumping in to make this compatible with DNN 9.8!

@maduranga001
Copy link

I am having the same issue. I upgraded to DNN 9.8.1 and updated the Events module to 7.0.6 version. The module is loading with an error and the page is breaking.

Please can you advise how to fix this? I a using the installable PA version of the Events module.

@MaiklT
Copy link

MaiklT commented Jan 17, 2021

@maduranga001 To fix this at the moment you have the following possibilities:

  1. Stay on DNN 9.7.2 until an upgrade of the Events module is available.
  2. Create a fork, fix the issue and start a pull request.

As we see in Brian's and Ernst Peter's post above, a solution should be near...

@maduranga001
Copy link

Thank you @malikt
Actually, now we have already upgraded to DNN 9.8.1 and we have to stay with it. So I have to wait for the new release.

@maduranga001 To fix this at the moment you have the following possibilities:

  1. Stay on DNN 9.7.2 until an upgrade of the Events module is available.
  2. Create a fork, fix the issue and start a pull request.

As we see in Brian's and Ernst Peter's post above, a solution should be near...

@EPTamminga
Copy link
Member

EPTamminga commented Jan 17, 2021

Testing and verification

I just installed a clean DNN981, installed a clean Events706 and did not find any error...
It works as expected, including a limitation for a category and/or a location in the module settings with no errors.

I installed the Events706 on a clean DNN972, created events, no problem.
Created an addition module instance in a separate page and used a limitation in category and location.
In DNN972, no problem. I upgraded to DNN981. The events module that did not have a limitation on location and category had no problem, the instance that had the limitation, did have the error.

Hotfixing the problem

By deleting (by SQL) the modulesettings table that limits the category and/or location, I can make the module work again. The only negative effect is that you have to reapply the limits on categories and/or locations in the module settings, because those limitations are removed by the SQL statement.

Hotfix

The SQL statement (to be used from the SQL console in the Host) is:

DELETE  FROM {databaseOwner}[{objectQualifier}ModuleSettings]
WHERE   ModuleID IN
        (
            SELECT DISTINCT MS.ModuleID
            FROM   {databaseOwner}[{objectQualifier}ModuleSettings] AS MS
                INNER JOIN {databaseOwner}[{objectQualifier}Modules] AS MO 
				    ON MO.ModuleID = MS.[ModuleID]
                INNER JOIN {databaseOwner}[{objectQualifier}ModuleDefinitions] AS MD
                    ON MD.ModuleDefID = MO.ModuleDefID
            WHERE MD.DefinitionName = 'Events'
        )
        AND [ModuleSettings].SettingName LIKE 'Module%Ids';

Events707

In the Events707 update, I will implement this delete statement, so the upgrade will also remove the settings since I see no option to upgrade the settings.

Verification?

I would be more than happy if people here could verify the solution I listed here.
@MaiklT @maduranga001 @djamell @blair260 @james7342 @brewadmin Any of you willing to test it in your scenario?

New version in the works

In the meantime, I will change the locationId's settings as mentioned by @bdukes

@james7342
Copy link

james7342 commented Jan 17, 2021

@EPTamminga
Performed the below tests. The workaround is short lived. Once the application is restarted the error returns on page load.

Environment:
DNN 9.7.2
Events 7.0.6

Test Setup:
Events Module on Page
Create 2 Locations via Edit Locations (Test1, Test2)
Create 3 Test Events
2 with the locations assigned (Test1, Test2)
1 with No Location

Test Case 1:
Adjust Module Filter Location (Events/Edit Setting/Filter Events by Location)
Set Module Filter to Test1, Load Page, Only Test1 Events displayed
Set Module Filter to Test2, Load Page, Only Test2 Events displayed
Set Module Filter to All, Load Page All Events displayed
Everything works as expected

Test Case 2:
Upgrade to DNN 9.8.1
Verified page Load Failure
Ran Delete SQL statement in Host/DNN SQL Console
Page still had error message
Restart Application - Host/Servers - Critical in order for the page to load properly
Page Loads without Error
Adjust Module Filter Location (Events/Edit Setting/Filter Events by Location)
Set Module Filter to Test1, Load Page, Only Test1 Events displayed
Set Module Filter to Test2, Load Page, Only Test2 Events displayed
Set Module Filter to All, Load Page All Events displayed
Everything Works as expected

Test Case 3:
Restart Application - Host/Servers
Page Load Failure same error
Failure

Let me know of you want me to do any further testing. I run my test environment in VMware and create snapshots before I do anything. Easy restore back to starting point.

@EPTamminga
Copy link
Member

@james7342 You are right. I did not restart the site while testing myself.

@EPTamminga
Copy link
Member

@james7342 In your test environment: update the bin with the following files, but DO clean the settings with the SQL first.

EVents707DLL.zip

@maduranga001
Copy link

Thank you very much.
If I try the above solution for now, how do we use the next new version? Do you have the solution to replace before we install the newer version?

@EPTamminga
Copy link
Member

@maduranga001 First of all, do not use the above things in a production environment. They are just for testing purposes here.

I will create a new version (Events 7.0.7, that will handle all the update stuff, with one exception: if you have used the locations and/or category limitations in the module settings, you have to reapply them after installing the new version.
I will try to limit the update to the location settings, but I have to do some testing first..

@james7342
Copy link

james7342 commented Jan 17, 2021

@EPTamminga

Different error this time, but still a failure after restarting application.

Test Setup:
DNN981
Event706

Test Case 1:
Confirm page load failure
Run Delete SQL statement in Host/DNN SQL Console
Copy Test DLL files in to Root/Bin Folder (EVents707DLL.zip)
Restart Application - Host/Servers
Page Load without error
Adjust Module Filter Location (Events/Edit Setting/Filter Events by Location)
Set Module Filter to Test1, Load Page, Only Test1 Events displayed
Set Module Filter to Test2, Load Page, Only Test2 Events displayed
Set Module Filter to All, Load Page, All Events displayed
Everything works as expected

Test Case 2:
Restart Application - Host/Servers
Page Loads with error - Though different error message then prior and no Events shown.

Error: Events is currently unavailable. DotNetNuke.Services.Exceptions.ModuleLoadException: Input string was not in a correct format. ---> System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.String.System.IConvertible.ToInt32(IFormatProvider provider) at Components.EventModuleSettings.get_ModuleLocationsSelected() in C:\DDrive\Develop\GitHub\DNN.Events\Components\EventModuleSettings.cs:line 454 at DotNetNuke.Modules.Events.SelectLocation.get_SelectedLocation() in C:\DDrive\Develop\GitHub\DNN.Events\SubControls\SelectLocation.ascx.cs:line 119 at DotNetNuke.Modules.Events.EventMonth.BindDataGrid() in C:\DDrive\Develop\GitHub\DNN.Events\EventMonth.ascx.cs:line 167 at DotNetNuke.Modules.Events.EventMonth.Page_Load(Object sender, EventArgs e) in C:\DDrive\Develop\GitHub\DNN.Events\EventMonth.ascx.cs:line 113 --- End of inner exception stack trace ---

screenshot_1923

@EPTamminga
Copy link
Member

@james7342
Tnx for testing., I think I see what I have to change more.
I will try to set up a better test cycle (similar to yours), so I can verify it myself before bothering others :-)

More tomorrow.

@blair260
Copy link

@EPTamminga and @james7342 - has anyone had any luck with getting this to work? I tried with the build but keep getting the same, or something similar, error. What are you guys thinking? Thanks for all the help here! - Sam

@james7342
Copy link

@blair260- Nothing is fixed yet in code and the potential workaround doesn’t work long term. Ernst was going to do some more work on it, but I’m sure the day job might be getting in the way. Anyone running the module should hold off on upgrading to DNN 9.8.X at this point until it’s resolved.

@EPTamminga
Copy link
Member

I am still on it, but due to work and some private matters, I could not allocate time to do the requires changes and testing.
It is on my list...

@EPTamminga
Copy link
Member

I could finally allocate time to have a new round on the error.

Do not do the following things on a production site!

The instruction is for testing purposes only!

Instruction for validation

The instruction below can be executed on an upgraded site (DNN980 or DNN981) that has DNNEvents 7.0.6 installed and produces the error.

Run the following SQL statement in the Host/SQL option, to clear out the setting that causes the error (you will lose the location limitation setting in the module settings, but that has to go)

DELETE  FROM {databaseOwner}[{objectQualifier}ModuleSettings]
WHERE   ModuleID IN
        (
            SELECT DISTINCT MS.ModuleID
            FROM   {databaseOwner}[{objectQualifier}ModuleSettings] AS MS
                INNER JOIN {databaseOwner}[{objectQualifier}Modules] AS MO 
				    ON MO.ModuleID = MS.[ModuleID]
                INNER JOIN {databaseOwner}[{objectQualifier}ModuleDefinitions] AS MD
                    ON MD.ModuleDefID = MO.ModuleDefID
            WHERE MD.DefinitionName = 'Events'
        )
        AND [ModuleSettings].SettingName = 'ModuleLocationIds';

Unzip the files in the attached zip en copy (overwrite) them in the bin folder of the site.
Events707TestDLL.zip

Things should work now without error.

Please provide feedback

@MaiklT @maduranga001 @djamell @blair260 @james7342 @brewadmin Any of you available to do some testing?

If I get confirmation on success, I will create a new DNNEvents release

@james7342
Copy link

james7342 commented Jan 31, 2021

Ernst, I think you might have got it.

Starting Environment:
DNN 9.7.2
Events 7.0.6

Test Setup:
Events Module on Page
Create 2 Locations via Edit Locations (Test1, Test2)
Create 3 Test Events
2 with the locations assigned (Test1, Test2)
1 with no Location

Test Case 1:
Adjust Module Filter Location (Events/Edit Setting/Filter Events by Location)
Set Module Filter to Test1, Load Page, Only Test1 Events displayed
Set Module Filter to Test2, Load Page, Only Test2 Events displayed
Set Module Filter to All, Load Page All Events displayed
Everything works as expected

Test Case 2:
Upgrade to DNN 9.8.1
Verified page Load Failure
Run Delete SQL statement in Host/DNN SQL Console
Page still had error message
Restart Application - Host/Servers - Critical in order for the page to load properly
Page loads without error
Copy Test DLL files in to Root/Bin Folder (Events707TestDLL.zip)
Restart Application - Host/Servers - Critical in order for the page to load properly
Verify page still loads without error on new DLL's
Adjust Module Filter Location (Events/Edit Setting/Filter Events by Location)
Set Module Filter to Test1, Load Page, Only Test1 Events displayed
Set Module Filter to Test2, Load Page, Only Test2 Events displayed
Set Module Filter to All, Load Page All Events displayed
Everything Works as expected

Test Case 3:
Restart Application - Host/Servers - Just to perform additional reset
Verify page still loads without error
Adjust Module Filter Location (Events/Edit Setting/Filter Events by Location)
Set Module Filter to Test1, Load Page, Only Test1 Events displayed
Set Module Filter to Test2, Load Page, Only Test2 Events displayed
Set Module Filter to All, Load Page All Events displayed
Everything Works as expected

Test Case 4:
Restart Dev/Test PC Virtual Machine
Verify page still loads without error
Adjust Module Filter Location (Events/Edit Setting/Filter Events by Location)
Set Module Filter to Test1, Load Page, Only Test1 Events displayed
Set Module Filter to Test2, Load Page, Only Test2 Events displayed
Set Module Filter to All, Load Page All Events displayed
Everything Works as expected

@EPTamminga
Copy link
Member

@james7342 Thank you for your feedback!

@brewadmin
Copy link

brewadmin commented Feb 1, 2021 via email

@MaiklT
Copy link

MaiklT commented Feb 1, 2021

@brewadmin There is already an issue (#85) about this.

@EPTamminga
Copy link
Member

EPTamminga commented Feb 3, 2021

I have created an update (07.00.07) that should solve the problem.

I have to some additional research, because I have the idea that the default filtering on categories and/or locations in the module settings are not saved on restarts. If you do not use this setting (most users do not use this particular filtering), you do not have to worry.
I will combine this with the removal of the Telerik controls that are used for these sestings (multi select combobox).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants