Error "Invalid Attempt to read when no data is present" after upgrade to 7.5

Vote:
 

Hello, 

I have recently upgraded one of our sites to 7.5 (using the deployment center, and installing nuget package: Install-Package EPiServer.CMS.UI -Version 7.19.1 - as this seems to contain all the latest dependencies as well)

but now I get error: 

[InvalidOperationException: Invalid attempt to read when no data is present.]
   System.Data.SqlClient.SqlDataReader.CheckDataIsReady(Int32 columnIndex, Boolean allowPartiallyReadColumn, Boolean permitAsync, String methodName) +6712526
   System.Data.SqlClient.SqlDataReader.TryReadColumn(Int32 i, Boolean setTimeout, Boolean allowPartiallyReadColumn) +81
   System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i) +43
   System.Data.SqlClient.SqlDataReader.GetValue(Int32 i) +151
   EPiServer.DataAccess.ContentListDB.b__0() +860
   EPiServer.Data.Providers.<>c__DisplayClass1`1.b__0() +60
   EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute(Func`1 method) +150
   EPiServer.Web.SiteDefinition.get_WasteBasket() +271
   EPiServer.Core.ContentReference.get_WasteBasket() +132
   EPiServer.Core.PageData.get_LinkURL() +206
   EPiServer.Web.Routing.MultiplexingRouteHandler.GetPathRouteHandler(String path, PageData page, String language) +60
   EPiServer.Web.Routing.MultiplexingRouteHandler.GetPageRouteHandler(Object routedData, String path, String language, Boolean return404) +47
   EPiServer.Web.Routing.MultiplexingRouteHandler.GetRouteHandlerOrRedirect(RequestContext requestContext, Object routedData, Boolean throw404IfNotFound) +300
   EPiServer.Web.Routing.MultiplexingRouteHandler.GetRouteHandler(RequestContext requestContext) +343
   EPiServer.Web.Routing.MultiplexingRouteHandler.GetHttpHandler(RequestContext requestContext) +22
   System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +12773767
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165

Can anyone help with where I can try diagnosing this?

Many thanks!
Gabor
#123074
Jun 24, 2015 13:30
Vote:
 

I also get an error when logging onto the admin area. I can get to the logon page, but then when attempting to log on. I get: 

at System.Data.SqlClient.SqlDataReader.CheckDataIsReady(Int32 columnIndex, Boolean allowPartiallyReadColumn, Boolean permitAsync, String methodName)
at System.Data.SqlClient.SqlDataReader.TryReadColumn(Int32 i, Boolean setTimeout, Boolean allowPartiallyReadColumn)
at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i)
at System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)
at EPiServer.DataAccess.ContentListDB.<LoadDefaultSystemDefinition>b__0()
at EPiServer.Data.Providers.SqlDatabaseHandler.<>c__DisplayClass1`1.<Execute>b__0()
at EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute[TResult](Func`1 method)
at EPiServer.Data.Providers.SqlDatabaseHandler.Execute[TResult](Func`1 action)
at EPiServer.DataAccess.ContentListDB.LoadDefaultSystemDefinition()
at EPiServer.Web.SystemDefinition.get_Current()
at EPiServer.Web.SiteDefinition.get_RootPage()
at EPiServer.Cms.Shell.CmsModule.CreateViewModel(ModuleTable moduleTable, IClientResourceService clientResourceService)
at EPiServer.Shell.UI.Bootstrapper.<CreateViewModel>b__1(ShellModule module)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
at EPiServer.Framework.Serialization.Json.JsonObjectSerializer.Serialize(TextWriter textWriter, Object value)
at EPiServer.Shell.Web.Mvc.Html.ScriptExtensions.SerializeObject(HtmlHelper html, Object value, String contentType)
at ASP.episerver_shell_views_shared_bootstrapper_aspx.__Render__control5(HtmlTextWriter __w, Control parameterContainer) in http://server/episerver/Shell/Views/Shared/Bootstrapper.aspx:line 51
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at ASP.episerver_shell_views_shared_sleek_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in http://server/episerver/Shell/Views/Shared/Sleek.Master:line 30
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Page.Render(HtmlTextWriter writer)
at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The only thing I can think of is that a dll is incorrect, or referencing an older version, as this seems to be internal to episerver... 

#123090
Jun 24, 2015 17:16
Vote:
 

Have you tried executing "Upgrade/disable add-ons after product upgrade" in deployment center?

#123091
Jun 24, 2015 17:20
Vote:
 

yes, I have. It's fixed some other errors, but not this one... 

#123092
Jun 24, 2015 17:26
Vote:
 

This is really wild guess, but do you still have any leftovers of "siteHostMapping" elements in episerver framework config file under <episerver.framework> element?

#123100
Jun 24, 2015 20:35
Vote:
 

No, there's nothing relating to that. I haven't updated my VPP's yet. WOuld that have any effect on it? I was under the impression, that the admin area should work before the VPP's need to be migrated... 

#123114
Jun 25, 2015 10:04
Vote:
 

Hi!

I have the same exact problem. Same stacktrace and all. I have done almost exactly the same steps as you. As far as I have been able to trace, the error seems related to a row in tblContent that is missing.

If you execute the stored procedure called dbo.netContentRootList on your upgrade database, you will se that a row that should contain the ID for ContentAsset is missing. It seems the upgrade does not add this correctly to the database.

Another interesting thing is that i did the EXACT same upgrade about a week ago, and then it worked.

It would be great if someone from EPiServer could check into this and see if there is anything wrong with the upgrade process. It only happens when going from <7 to 7.5 or higher.

#123133
Jun 25, 2015 13:41
Vote:
 

It's actually not related to VPP. Can you please paste your <connectionStrings> element. I don't need passwords though:)

Also I would probably run SQL Trace at that time and see what's going on around "netContentRootList" stored procedure execute in trace file.

#123134
Jun 25, 2015 13:45
Vote:
 

I don't think the issue is related to the connectionstring since everything else in the upgrade works fine. No errors is generated in the logfiles or error messages displayed in deployment-center.

The netContentRootList is only used to fetch the id:s for root, wastebasket, contentassets and globalassets when the site definitions are loaded. All the rows for these values are stored in tblContent. But the value/row for contentasset (the row with the corresponding GUID from the stored procedure) is missing after the upgrade to 7.5 from deploymentcenter is done.

#123136
Jun 25, 2015 13:58
Vote:
 

Reason I asked about connection strings is that you may experience similar SQL-ish issues if you have not specified MultipleResultSets=true in connection string.

Gabor, can you verify that you get back 4 records from "netContentRootList" procedure? Something like:

RootPage=1
WasteBasket=2
GlobalAssets=3
ContentAssets=4
#123148
Jun 25, 2015 15:32
Vote:
 

Thank you Valdis, 

I checked the connection string, it does contain multipleActiveResultSets=true.: 

  <add name="EPiServerDB" connectionString="Data Source=SQL;Initial Catalog=****;Integrated Security=False;User ID=**;Password=**;MultipleActiveResultSets=True;Connect Timeout=10" providerName="System.Data.SqlClient" />

I have run the netContentRootList, and the resultant value for contentAssets is nothing. So I expect that's the reason? Where can I find what ID to put into here? 

#123151
Edited, Jun 25, 2015 15:57
Vote:
 

A possible workaround would be to create a content folder in an initializable module during startup and set the id of the content folder in the database:

var _contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
var folder = _contentRepository.GetDefault<SysContentFolder>(ContentReference.RootPage);
folder.Name = "SysContentAssets";
ContentReference contentLink = _contentRepository.Save(folder, SaveAction.Publish, AccessLevel.NoAccess);

int contentAssetsId = contentLink.ID;

However, don't you think the Content Asset folder is created as part of the VPP migration? If I understood you correct you haven't run it at this point?

#123153
Edited, Jun 25, 2015 16:07
Vote:
 
<p>THat would make sense Mattias, I'll run the VPP migration now, let's see what happens. It was just that following the migration path, I assumed that at least the admin area should have loaded before I was supposed to do the VPP migration.&nbsp;</p> <p></p> <p>I'll try it now.&nbsp;</p>
#123157
Jun 25, 2015 16:22
Vote:
 

I'm not sure it will work out, it was just a guess. Perhaps the content asset folder should already be there from the beginning in a CMS 7 site (such a long time since I worked with version 7). I guess blocks could be stored as a content asset and not only as a global asset in CMS 7. In that case it should already exist, and then again, maybe not if all the blocks on the site was created in the global assets folder. :)

What results do you get from running this SQL Query:

SELECT 
    [dbo].[tblContent].pkID, 
    [dbo].[tblContentLanguage].Name FROM [dbo].[tblContent] 
INNER JOIN [dbo].[tblContentLanguage] 
    ON [dbo].[tblContentLanguage].fkContentID = [dbo].[tblContent].pkID 
WHERE fkContentTypeID = (SELECT pkID FROM [dbo].[tblContentType] where [Name] = 'SysContentFolder') AND ContentPath = '.1.' 
#123160
Jun 25, 2015 16:40
Vote:
 

I Get: 44 Shared Block Root

Our sites do not use blocks at all, as we've never re-engineered the sites to implement blocks... 

#123162
Jun 25, 2015 16:52
Vote:
 

Btw, the content assets id for a site of ours (upgraded from CMS 7 to 7.5 a long time ago) had a very high number (> 12000). If it was created automatically when the site was setup from the beginning it would have a much lower number, like 4 or something.

#123163
Jun 25, 2015 16:55
Vote:
 

Well, then it seems like it doesn't exist at all, perhaps because you never created anything as a content asset. I get two rows when running that SQL query on an upgraded site, one is SysBlocksRoot and the other is SysContentAssets.

You could try out the possible workaround I suggested earlier or if possible, rollback the upgrade and try to create a simple block type and try to add it as a content asset (if you even see the "For this page" folder in the UI).

#123164
Jun 25, 2015 17:04
Vote:
 

I just considering, what if you migrate your VPP to new BLOB storage. This might help as if I remember correctly migration tool make sure that there is content assets folder in target site. If not - it should create one.

Otherwise, there is a dirty workaround for this - to insert required records for content,  content type (if necessary). But I REALLY would try to avoid that.

#123171
Jun 25, 2015 22:55
Vote:
 

Hey, so I tried the migration tool, but interestingly, that gives me the same error... So I'm going to try the workaround. Let's see what happens

#123199
Jun 26, 2015 13:28
Vote:
 

Hm, OK. Strange. If workaround fails - I can give nasty SQL scripts to execute to create asset folders manually..

#123201
Jun 26, 2015 14:04
Vote:
 

Valdis, I have managed to get the site up and running, but I had to go into the content table and update content type id's of folders, and that seems to have resolved the site loading issue. I also had to update the guid in the netContentRootList stored procedure the the GUID of the new folder. 

If that's ok with you, I'd like to have the sql scripts to run on the live site, as I'm not comfortable with what I had to do to get things working - it does feel rather dirty. 

I've tried the migration tool now, but I get the following error: 

Content with Guid "00000000-0000-0000-0000-000000000000" was not found
at EPiServer.DataFactory.Get[T](Guid contentGuid, ILanguageSelector languageSelector)
at EPiServer.Core.ContentLanguageSettingsHandler.GetClosestSettingNoCache(ContentReference contentLink, Dictionary`2 allSettings)
at EPiServer.Core.ContentLanguageSettingsHandler.<>c__DisplayClass4.<GetClosestSetting>b__3(ContentReference c)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at EPiServer.Core.ContentLanguageSettingsHandler.GetClosestSetting(ContentReference contentLink)
at EPiServer.Core.ContentLanguageSettingsHandler.Get(ContentReference contentLink)
at EPiServer.Core.ContentLanguageSettingsHandler.Get(ContentReference contentLink, String languageBranch)
at EPiServer.Core.LanguageSelector.LoadLanguage(LanguageSelectorContext context)
at EPiServer.Core.ContentProvider.LoadChildren[T](ContentReference contentLink, ILanguageSelector selector, Int32 startIndex, Int32 maxRows)
at EPiServer.DataFactory.GetChildren[T](ContentReference contentLink, ILanguageSelector selector, Int32 startIndex, Int32 maxRows)
at EPiServer.DataFactory.GetChildren[T](ContentReference contentLink, ILanguageSelector selector)
at EPiServer.DataFactory.GetChildren[T](ContentReference contentLink)
at VppMigrationTool.Util.VppConverter.RebuildUrlSegment(ContentReference contentLink) in c:\Development\unversioned\Episerver\VPPMigration\VppMigrationTool\Util\VppConverter.cs:line 154
at VppMigrationTool.Util.VppConverter.Convert() in c:\Development\unversioned\Episerver\VPPMigration\VppMigrationTool\Util\VppConverter.cs:line 55

on line :

 

private void RebuildUrlSegment(ContentReference contentLink)
{
>>>foreach (var folder in _contentRepository.GetChildren<ContentFolder>(contentLink))

I'm starting to believe that I have done something fundamentally wrong... 

#123206
Jun 26, 2015 15:51
Vote:
 

I would suggest you to install alloytech EPiServer 7.0 website and upgrade it using the deployment center to ensure the upgrade process is working for you. I have recently updated a website from EPiServer 7.0 to EPiServer 7.5 and never seen this issue. May be I was lucky, but I would suggest you to take a step back and try to find, why you are getting this error message. Re-run the process on alloytech to ensure the upgrade process is working should be your first step. Once you have established  the process is working on alloytech, then can you isolate the issue with your website and can fix it :)

#123207
Jun 26, 2015 16:31
Vote:
 

Gabor, can you paste excat updates you made to tblContent to get site up and running? That may show some evidences..

But anyway I've made lot of upgrades for various size sites and projects and never came across this kind of issue, so I agree with Tahir.. It makes sense to make one step back and try to make an upgrade for Alloy using the same approach you took for your project and see what's happening there.

#123213
Jun 27, 2015 10:04
Vote:
 
<p>Hello Valdis,&nbsp;</p> <p>I looked in netContentRootList at what it was expecting:&nbsp;</p> <p></p> <pre class="brush:sql;auto-links:false;toolbar:false" contenteditable="false">SELECT pkID as RootPage from tblContent WHERE ContentGUID = '43F936C9-9B23-4EA3-97B2-61C538AD07C9' SELECT pkID as WasteBasket from tblContent WHERE ContentGUID = '2F40BA47-F4FC-47AE-A244-0B909D4CF988' SELECT pkID as GlobalAssets from tblContent WHERE ContentGUID = 'E56F85D0-E833-4E02-976A-2D11FE4D598C' SELECT pkID as ContentAssets from tblContent WHERE ContentGUID = '1C467AF0-BD99-414E-AECB-4E333BD218BC'--'99D57529-61F2-47C0-80C0-F91ECA6AF1AC'</pre> <p><br />for contentAssets, it had the commented out guid, which did not exist. I created a row in tblContent, copying one of the other rows where contenttype was 2.&nbsp;</p> <p></p> <p>That allowed it to work, but the VPP upgrade is still not working...&nbsp;</p> <p></p> <p>I'm currently trying to upgrade some other sites, to see if I get to the same error with those. I'll update you if I can finally get it working.&nbsp;&nbsp;</p>
#123674
Jul 14, 2015 15:36
Vote:
 

I'm in the process of upgrading a 6R2-site and it ended up with a missing ContentAssets row in the DB.

Background:

I did the upgrades all the way from 6R2 to 10. Then I wanted to "practice" the upgrade process one more time before I would do the same with production data. But I got stuck after the upgrade to 7.5 via Deployment Center. Giving me the error: Invalid Attempt to read when no data is present.

Solution:

Running the stored procedure netContentRootList shows that there's no record for ContentAssets in tblContent.

So I added the missing record with the following sql. I used the same fkContentTypeId as GlobalAssets used in my database. Worth checking what your database uses.

INSERT INTO tblContent (fkContentTypeID, fkParentID, ArchiveContentGUID, CreatorName, ContentGUID, VisibleInMenu, Deleted, PendingPublish, ChildOrderRule, PeerOrder, ExternalFolderID, ContentAssetsID, ContentOwnerID, PublishedVersion, DeletedBy, DeletedDate, fkMasterLanguageBranchID, ContentPath, ContentType, IsLeafNode) VALUES 
(75, 1, NULL, '', '99D57529-61F2-47C0-80C0-F91ECA6AF1AC', 1, 0, 0, 3, 100, 0, NULL, NULL, NULL, NULL, NULL, 15, '.1.', 2, 1);

Edit:

I later got new problems with missing records in tblContentLanguage that had direct correlation with the manually created record in tblContent.

I did som digging and I found some odd data in the database. In tblContentLanguage I had a record for GUID E56 with the name SysBlocksRoot. This is non existing in my working database - where E56 points to SysSiteAssets.

So some missmatch is going on!

Solution #2:

I started from the beginning (fifth time). Only this time I did the setup for 6R2 (site, DB and VPP). Then I upgraded to EPi 7 with Deployment Center. Then I did the upgrade directly to EPi 7.5 (no building or code-fixing). Now the database got correct records in both tblContent and tblContentLanguage.

#185786
Edited, Dec 01, 2017 13:50
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.