Error After Upgrade

Gabriel Avila asked on April 5, 2017 22:41

After Migrating all the code and Database data Manually from Kentico 5.5R2 to Kentico 10, The code compiles perfectly in VS2015 but once I attempt to rin the Site I encounter the eeror posted bellow, any and all help would be gladly appreciated.

Server Error in '/' Application.

[SqlHelper.ReplaceSource]: Missing ##SOURCE## macro in the query text 'SELECT [TranslationText], [StringKey], [CultureCode] FROM CMS_ResourceString WHERE ##WHERE## ORDER BY ##ORDERBY##', cannot apply the source 'View_CMS_ResourceString_Joined'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotSupportedException: [SqlHelper.ReplaceSource]: Missing ##SOURCE## macro in the query text 'SELECT [TranslationText], [StringKey], [CultureCode] FROM CMS_ResourceString WHERE ##WHERE## ORDER BY ##ORDERBY##', cannot apply the source 'View_CMS_ResourceString_Joined'.

Source Error:

Line 19: string mPrefix = "http://"; Line 20: Line 21: titleElem.TitleText = GetString("Message.InvalidWebSite"); Line 22: string mDomain = RequestContext.URL.Host; Line 23: if (RequestContext.URL.Port != 80)

Source File: E:\webcmsdev\cmsmessages\invalidWebsite.aspx.cs Line: 21

Stack Trace:

[NotSupportedException: [SqlHelper.ReplaceSource]: Missing ##SOURCE## macro in the query text 'SELECT [TranslationText], [StringKey], [CultureCode] FROM CMS_ResourceString WHERE ##WHERE## ORDER BY ##ORDERBY##', cannot apply the source 'View_CMS_ResourceString_Joined'.] CMS.DataEngine.SqlMacroHelper.ReplaceSource(String queryText, String source, String defaultSource) +237 CMS.DataEngine.SqlMacroHelper.ResolveMacrosInQueryText(QueryMacros queryMacros, String queryText) +88 CMS.DataEngine.SqlMacroHelper.ResolveQueryMacros(QueryMacros queryMacros, String queryText) +47 CMS.DataEngine.QueryParameters.ResolveMacrosInternal(Boolean updateQueryText) +54 CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query) +27 CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query, Int32& totalRecords) +62 CMS.DataEngine.DataQueryBase1.GetDataFromDBInternal() +104 CMS.DataEngine.DataQueryBase1.GetDataFromDB() +49 CMS.DataEngine.DataQueryBase1.GetData() +118 CMS.DataEngine.DataQueryBase1.get_Result() +93 CMS.DataEngine.ObjectQueryBase2.GetResults(IDataQuery query, Int32& totalRecords) +17 CMS.DataEngine.DataQueryBase1.GetDataFromDB() +75 CMS.DataEngine.DataQueryBase1.GetData() +118 CMS.DataEngine.ObjectQueryBase2.GetData() +108 CMS.DataEngine.DataQueryBase1.get_Result() +93 CMS.Localization.ResourceStringInfoProvider.LoadStringGeneration(ProviderDictionaryCollection sender, Int32 generation, Object parameter) +114 CMS.DataEngine.ProviderDictionaryCollection.LoadGeneration(Int32 generation) +114 CMS.DataEngine.ProviderDictionaryCollection.LoadDefaultItems() +49 CMS.Localization.ResourceStringInfoProvider.get_Resources() +303 CMS.Localization.ResourceStringInfoProvider.GetStringInternal(String key, String cultureCode, String defaultValue, Boolean useDefaultCulture) +59 CMS.Localization.SQLLocalizationSource.GetString(String stringName, String culture) +34 CMS.Localization.<>c__DisplayClasse.<GetStringFromLocalizationSource>b__7(ILocalizationStringSource source) +19 System.Linq.WhereSelectArrayIterator2.MoveNext() +58 System.Linq.Enumerable.FirstOrDefault(IEnumerable1 source, Func2 predicate) +94 CMS.Localization.LocalizationHelper.GetStringFromLocalizationSource(String stringName, String culture, Boolean useDefaultCulture, IEnumerable`1 sources) +175 CMS.Localization.LocalizationHelper.GetStringInternal(String stringName, String culture, String defaultValue, Boolean useDefaultCulture, Boolean allowMultiple) +229 CMS.Localization.LocalizationService.GetString(String stringName, String culture, Boolean useDefaultCulture) +38 CMS.UIControls.AbstractCMSPage.GetString(String stringName) +63 CMSMessages_invalidWebsite.Page_Load(Object sender, EventArgs e) in E:\webcmsdev\cmsmessages\invalidWebsite.aspx.cs:21 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Control.OnLoad(EventArgs e) +95 CMS.UIControls.CMSPage.OnLoad(EventArgs e) +64 System.Web.UI.Control.LoadRecursive() +59 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2952


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1085.0

Recent Answers


Roman Hutnyk answered on April 6, 2017 08:52

Did it worked in Kentico 9 and previous version?

Have you upgraded to each major version: 5.5R2 -> 6.0 -> 7.0 -> 8.0 -> 8.1 -> 8.2 -> 9.0 -> 10.0?

0 votesVote for this answer Mark as a Correct answer

Gabriel Avila answered on April 6, 2017 13:37 (last edited on April 6, 2017 13:41)

I was performing Upgrade Version to version 5.5R2 -> 6.0 -> 7.0 -> 8.0 -> 8.1 -> 8.2 -> 9.0 -> 10.0 but when I reached v9.0 I confronted several errors that after posting about those here on the forums I was suggested maybe going straight into 10 would be a better approach. So I changed My strategy and after several days importing the database code and upgrading manually the source for all our custom stuff I come upon this error. For me I believe there is something wrong with the data even though everything is there because I'm getting this error on code that is 100% native Kentico 10 without modifications to it.

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on April 6, 2017 13:40

You can't go straight from v5.5 to 10.

0 votesVote for this answer Mark as a Correct answer

Gabriel Avila answered on April 6, 2017 13:59

I do understand there is no direct upgrade path from 5.5R2 to 10. Yet If i'm able to understand how the code behaves I can make my implementation work. Now without the addded extra information from 5.5R2 the code itself worked but no site was available/displayed. After adding the data records that were present in 5.5R2 while NOT replacing the existing data that was the same (only records which were not present on 10) I get this error.

After debugging a little bit over where the error is being thrown, it comes down to the GetString() method failing. Now, How does the method GetString() works? Where does the method get its data from (Table/Stored Procedure/View)?

If I get this answer I'll be able to determine what is the datat failing and fix it.

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on April 6, 2017 14:05

GetString() method retrieves localized string for specified key. They are stored in CMS_ResourceString table.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 6, 2017 16:27

A few questions and suggestions.

Questions
1. When you ran the upgrade, at any point in the upgrade did you come across a failure you didn't resolve?
2. When you ran the upgrade, did you run the website after each successful code and database upgrade?
3. At what point did you receive this message? Maybe after upgrading to version 8 or version 9 or a different version?
4. Did you follow all the upgrade instructions provided with each new major upgrade?
5. Did you perform any customizations to the base code or database?
6. Have you upgraded all your custom code, transformations and webparts?

Suggestions
1. Have you thought about simply starting with a new version of Kentico vs. upgrading 7 different versions plus a hotfix and migrating your pages, content, custom code, etc. to the new version?
2. Have you contacted Kentico Support regarding this issue? Guessing they may have more info for you but you will need to provide them some pretty specific details (at least the answers to the 3 questions above).
3. Check out this Stack Overflow answer to make sure all of your code and database are upgrading properly after each major upgrade. This may tell you something isn't properly upgrading (code or database) when you may think it is.

1 votesVote for this answer Mark as a Correct answer

Gabriel Avila answered on April 6, 2017 16:51

Answers 1. No 2. Yes 3. The message posted here came into existence because as a result of attempting Suggestion #1. 4. Yes 5. No 6. Yes

As Suggestion #1 was my route of action I migrated the items on the database related to the site I'm running in Kentico 5.5R2 into a clean, new and running database instance of v10.

I'm trying currently to figure out the logic behind the offending function GetString(). As posted earlier by Roman Hutnyk it retrieves data from CMS_ResourceString which I've compared with the running Install of Kentico 10 and my migrated DB as it contains the exact same records in both. This makes me believe its actually doing something else which it should be coming from elsewhere during the localization interpreting. The site I'm migrating is only on English so there is no data for any other language on it.

Before migrating the database data (site) it was turned off so I would have expected v10 to startup the admin area at least but it does not as I get this error in the login screen.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 6, 2017 17:03

So when you say you "migrated the items on the database related to the site you're running in Kentico 5.5R2", what do you mean? How did you do this? Straight SQL queries? Kentico Import Toolkit?
Before getting too far into figuring out what the GetString() method does or how it works, I'd focus more on your upgrade process and ensuring it is correct. There is a very, very strong chance the way you're migrating the data is not correct.

I'd start out with a fresh version of 10 with the latest hotfix and ensure it runs. Then start migrating data section by section (layouts, templates, pages, etc.). After you migrate each piece of data, run the site and see what comes up.

For your data migration, I'd highly suggest using the Kentico Import Toolkit. You can migrate data from the old database to the new one using a pretty simple UI tool.

0 votesVote for this answer Mark as a Correct answer

Gabriel Avila answered on April 7, 2017 22:46

Figured out the data I imported into the CMS_Queries and CMS_KeySettings were causing the main app to not load. Now I have the Site there but it seems that during my data migration some items need to be re-indexed and some have become Indexed incorrectly. Is there a document that will point out the database layout/mapping for each major object? (ex. Site, WebPart, Widgets, etc) so I can validate my data uploaded with the correct referencing everywhere?

The way I migrated the data was performed with a very similar tool/method that the Kentico Import Tool, but I uploaded everything from 5.5 that was not in 10. By doing this it seems I added additional Items that conflict between themselves.

Thanks Y'all :-)

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 7, 2017 23:11

Doing what you explained is really not any different than trying to export your 5.5 site and importing it into 10. The data has changed so much between 5 and 10 that you really need to go through the upgrade process vs starting with v10 and importing all the data from v5 into v10. Just akimf for trouble doing this IMHO.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.