Product content reference null after migration

Vote:
 

Hi!

So, I've just migrated Commerce from 8.15 to 9.17 and I encountered a problem. I use blocks that contain a content reference to a certain product (ProductContent). After migration, this content reference property is always null when fetching the block via IContentLoader.

Investigation step #1 - the database: I found the block and all its data. It still has a content reference to the product - 1693167__CatalogContent.

Investigation step #2 - IContentLoader: I try to fetch IContent based on the content reference

var cr = ContentReference.Parse("1693167__CatalogContent");
var content = _contentLoader.Get(cr);

It actually returns the correct product content.

Investigation step #3 - trying to understand: I try to fetch the content via version repository (by the way, the content references work id is 0)

var cr = ContentReference.Parse("1693167__CatalogContent");
var cv = _contentVersionRepository.Load(cr); // null
var test1 = _providerManager.GetProvider(cr.ProviderName).VersionRepository.Load(cr); // null
var test2 = _providerManager.GetProvider(cr.ProviderName).VersionRepository.LoadPublished(cr); // correct value

Investigation step #4 - trying everything: I try to resave the block and re-set the content reference.

var t5 = _contentLoader.Get(new ContentReference(12873)).CreateWritableClone() as ProductBrickBlock; // 12873 is the block
t5.ProductContentReference = ContentReference.Parse("1693167__CatalogContent");
_contentRepository.Save((IContent)t5, SaveAction.Publish, AccessLevel.NoAccess);

After this, the blocks content reference is no longer null. So resaving and re-setting the product content reference solves the issue.

Have I missed a step in the migration? Am I in any way using the wrong content provider?

#150162
Jun 13, 2016 10:58
* 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.