API
Version 7.x > API > Upgrade to v7 with some issues View modes: 
User avatar
Member
Member
whiplash - 12/18/2013 6:11:55 AM
   
Upgrade to v7 with some issues
Hi Guys

We have recently upgraded a site from v5, gone through upgrades until v7.

The project is now down to 2 errors, these are as follows:
 MacroResolver.OnResolveCustomMacro += new MacroResolver.MacroHandler(ResolveCustomMacro);
ClassHelper.OnGetCustomClass += new ClassHelper.GetClassEventHandler(GetCustomClass);

This code is in the Init() of CMSCustom class.

I have tried various options but can't seem to find a suitable replacement for the 'MacroHandler' and 'GetClassEventHandler' methods.

Does anyone have any idea? Some help on this would be much appreciated.

Thanks

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 12/18/2013 8:04:35 AM
   
RE:Upgrade to v7 with some issues
Hello,

For some reason the automatic replacement in the App_Code\Global\CMS\CMSCustom.cs file was not executed. Please, manually replace the old names with the new ones as described below:
using CMS.GlobalHelper; -> using CMS.GlobalHelper; using CMS.Compatibility;
MacroResolver.OnResolveCustomMacro -> MacroResolverCompatibility.OnResolveCustomMacro
MacroResolver.OnResolveCustomMacro -> MacroResolverCompatibility.OnResolveCustomMacro
MacroResolver.MacroHandler -> MacroResolverCompatibility.MacroHandler
ClassHelper.OnGetCustomClass -> ClassHelperCompatibility.OnGetCustomClass
ClassHelper.GetClassEventHandler -> ClassHelperCompatibility.GetClassEventHandler

Best regards,
Juraj Ondrus

User avatar
Member
Member
whiplash - 12/18/2013 8:19:58 AM
   
RE:Upgrade to v7 with some issues
Hi Juraj

OK - so, if I have interpreted that correctly then my code should be as follows:
MacroResolverCompatibility.OnResolveCustomMacro += MacroResolverCompatibility.MacroHandler(ResolveCustomMacro);
ClassHelperCompatibility.OnGetCustomClass += new ClassHelperCompatibility.GetClassEventHandler(GetCustomClass);

It seems the bolded Method 'MacroHandler' complains with "Non-invocable member 'CMS.Compatibility.MacroResolverCompatibility.MacroHandler' cannot be used like a method.

I have a good feeling I'm wrong lol

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 12/18/2013 10:15:28 AM
   
RE:Upgrade to v7 with some issues
Hello,

What was the upgrade path? I did this replacement on my upgraded version and it is working fine:
MacroResolverCompatibility.OnResolveCustomMacro += new MacroResolverCompatibility.MacroHandler(ResolveCustomMacro);

Also, this worked for other upgrades. It seems that something esle went wrong during the upgrade.

Best regards,
Juraj Ondrus

User avatar
Member
Member
whiplash - 12/18/2013 10:25:33 AM
   
RE:Upgrade to v7 with some issues
Hi

The upgrade path was going from v5 to 5.5 to 5.5R2 to 6 to 7


User avatar
Kentico Support
Kentico Support
kentico_jurajo - 12/18/2013 10:31:46 AM
   
RE:Upgrade to v7 with some issues
Hello,

Have you launched the site after each upgrade? This API change should have been done automatically already after upgrade to v6 - during the first site launch.
Have you followed all the instructions closely?

Best regards,
Juraj Ondrus

User avatar
Member
Member
whiplash - 12/18/2013 10:42:06 AM
   
RE:Upgrade to v7 with some issues
OK thanks for your assistance. We may have ran through the upgrades without launching the site after each upgrade, thinking we could fix the issues after all upgrades had run.

That was us trying to save time which doesn't seem to be the case.

Kind Regards

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 12/18/2013 10:58:18 AM
   
RE:Upgrade to v7 with some issues
Hello,

In the instructions, there are only things you have to do. There are no steps that are optional, only relevant things. During the first startup of the site some scripts and code is executed as well as automatic import of new web parts and modules is done (this was the first attempt to do as many things as possible in an automatic way).

Best regards,
Juraj Ondrus