Products

Solutions

Learn More

Partners

Community

Blog

About

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesWhy does UpgradeModule not fire?Why does UpgradeModule not fire?
Previous
 
Next
New Post
11/11/2016 5:25 AM
 

Hi,

This might be one of these "oh sh.. how could I forget this" things, as I have implemented IUpgradeable quite often - and this time I am stuck for days.

I have to upgrade a site to DNN 7.4.2, and therefore modify some smaller stuff in a custom module (Search...). One thing is to remove two controls, and that could only be done in the UpgradeModule method by implementing the IUpgradeable interface. So here is what I have done:

I created a method in the BusinessController class (that implements IUpgradeable):

      public string UpgradeModule(string version)
      {
         EventLog.AddLog("Upgrading myModule", string.Format("Version: {0}", version), EventLogController.EventLogType.ADMIN_ALERT);
         if ((version == "02.00.02") || (version == "2.0.2"))
         {
            RemoveModuleControl("SomeStuffIDontNeedAnyMoreKey");
            RemoveModuleControl("SomeOtherStuffIDontNeedAnyMoreKey");
         }
         return string.Format("Upgrading to version {0}", version);
      }

      private void RemoveModuleControl(string controlKey)
      {
         try
         {
            DesktopModuleInfo dmi = DesktopModuleController.GetDesktopModuleByModuleName("myModule", Null.NullInteger);
            ModuleDefinitionInfo mdi = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(dmi.FriendlyName, dmi.DesktopModuleID);
            ModuleControlInfo mci = ModuleControlController.GetModuleControlByControlKey(controlKey, mdi.ModuleDefID);
            ModuleControlController.DeleteModuleControl(mci.ModuleControlID);
            EventLog.AddLog("Upgrading myModule", string.Format("Module Control removed: {0}", controlKey), EventLogController.EventLogType.ADMIN_ALERT);
         }
         catch (Exception ex)
         {
            Exceptions.LogException(ex);
         }
      }

 As it is easy to see: The new module version is 2.0.2.

As I did not change the database structure, there is no 02.00.02.SqlDataProvider file - I tried to force the call by adding this to the manifest (anyway it should be called once at the end of the process, or after the restart to be more precise):

<component type="Module">
   <desktopModule>
      <moduleName>myModule</moduleName>
      [...]
      <businessControllerClass>[...]</businessControllerClass>
      <supportedFeatures>
         <supportedFeature type="Searchable" />
         <supportedFeature type="Upgradeable" />
      </supportedFeatures>
      <moduleDefinitions>
         <moduleDefinition>
            [...]
         </moduleDefinition>
      </moduleDefinitions>
      <eventMessage>
         <processorType>DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke</processorType>
         <processorCommand>UpgradeModule</processorCommand>
         <attributes>
            <businessControllerClass>[...]</businessControllerClass>
            <desktopModuleID>[DESKTOPMODULEID]</desktopModuleID>
            <upgradeVersionsList>01.00.00,02.00.00,02.00.02</upgradeVersionsList>
         </attributes>
      </eventMessage>
      [...]

When installing the upgrade, everything works fine, but this code never seems to get executed. I cannot even see the entries that should be created by the code in the event log.

Any ideas what I have forgotten?

Happy DNNing!
Michael


Michael Tobisch
DNN★MVP
helferlein.com - Michael Tobisch's Site about DNN, SQL Server, ASP.Net and other related stuff dnn-Connect.org - The most vibrant community around the DNN-platform
 
New Post
11/11/2016 6:06 AM
 

What I forgot to mention: There is an exception in the event log after the upgrade:

AbsoluteURL:/tabid/36/portalid/0/Default.aspx
DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID:4b234fe6-a83a-4660-ab0e-f224bc6c5dce
AssemblyVersion:
PortalId:-1
UserId:-1
TabId:-1
RawUrl:
Referrer:
UserAgent:
ExceptionHash:uUnGq/NfnnaXTOPZ2M6nLg==
Message:Value cannot be null. Parameter name: type
StackTrace:
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at DotNetNuke.Entities.Modules.EventMessageProcessor.UpgradeModule(EventMessage message)

InnerMessage:
InnerStackTrace:
Source:mscorlib
FileName:
FileLineNumber:0
FileColumnNumber:0
Method:
Server-Name: myDevServer

Any idea what that could mean?

Happy DNNing!
Michael


Michael Tobisch
DNN★MVP
helferlein.com - Michael Tobisch's Site about DNN, SQL Server, ASP.Net and other related stuff dnn-Connect.org - The most vibrant community around the DNN-platform
 
New Post
11/11/2016 6:46 AM
 
Hi Michael,

I don't know if this covers your case, but there are known problems wit IUpgradeable.

http://www.dnnsoftware.com/community-...

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
11/17/2016 4:42 AM
 

Hi Richard,

thanks for your answer. I tried to upgrade on a completely isolated web site. I went to the Host :: Extensions page (there is no instance of this module on this page), stopped the AppPool, refreshed the page (which lead to a Service unavailable message) restarted it, refreshed the page again (which brought me back to it), installed the upgrade - and failed. I am pretty sure it has nothing to do with the effects described above.

In the event log I found the same exception as above (the Url is the Host :: Extensions page) with a different ExceptionHash, and none of the entries that should be there from the UpgradeModule method.

Any ideas?

Happy DNNing!
Michael


Michael Tobisch
DNN★MVP
helferlein.com - Michael Tobisch's Site about DNN, SQL Server, ASP.Net and other related stuff dnn-Connect.org - The most vibrant community around the DNN-platform
 
New Post
11/17/2016 8:54 AM
 
Hi Michael,

I don't have any more.

I've never used IUpgradeable. I noticed it seemed like a great idea, but had no use for it. Then I saw Joe's post which warned me off.

Sorry.

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesWhy does UpgradeModule not fire?Why does UpgradeModule not fire?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
DNN Launch Webinar
REGISTER NOW
DNN Launch Webinar
REGISTER NOW
DNN Launch Webinar
REGISTER NOW