More in this section
Forums / Developing with Sitefinity / Exception thrown at CatalogManager.GetManager()

Exception thrown at CatalogManager.GetManager()

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
3 posts, 0 answered
  1. tim
    tim avatar
    8 posts
    30 Nov 2015
    14 Dec 2015
    Link to this post

    Trying to get Products from Sitefinity but getting a "Object reference not set to an instance of an object" error.  The code looks like this;

    public IList<Product> GetProducts()
    var catalogManager = CatalogManager.GetManager();

    List<Product> products = catalogManager.GetProducts().ToList();

    return products;

    Full error message:
    System.Reflection.TargetInvocationException was unhandled by user code
      Message=Exception has been thrown by the target of an invocation.
           at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
           at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
           at System.Activator.CreateInstance[T]()
           at Telerik.Sitefinity.Data.ManagerBase`1.GetManager[T](String providerName, String transactionName)
           at Telerik.Sitefinity.Data.ManagerBase`1.GetManager[T]()
           at Telerik.Sitefinity.Modules.Ecommerce.Catalog.CatalogManager.GetManager()
           at Sitefinity.Import.Repository.ImportProductRepository.GetProducts() in D:\Workspaces\ScrapArea\Certas.Sandpit\Sitefinity.Import.Repository\ImportProductRepository.cs:line 72
           at Sitefinity.Import.Repository.Tests.ImportProductRepositoryTests.Products_Are_Fetched() in D:\Workspaces\ScrapArea\Certas.Sandpit\Sitefinity.Import.Repository.Tests\ImportProductRepositoryTests.cs:line 24
           Message=Object reference not set to an instance of an object.
                at Telerik.Sitefinity.Abstractions.Exceptions.HandleException(Exception exceptionToHandle, ExceptionPolicyName policy, Exception& exceptionToThrow)
                at Telerik.Sitefinity.Abstractions.Exceptions.HandleException(Exception exceptionToHandle, ExceptionPolicyName policy)
                at Telerik.Sitefinity.Data.ManagerBase`1.Initialize()
                at Telerik.Sitefinity.Data.ManagerBase`1..ctor(String providerName, String transactionName)
                at Telerik.Sitefinity.Data.ManagerBase`1..ctor(String providerName)
                at Telerik.Sitefinity.Modules.Ecommerce.Catalog.CatalogManager..ctor(String providerName)
                at Telerik.Sitefinity.Modules.Ecommerce.Catalog.CatalogManager..ctor()
  2. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    06 Sep 2017
    17 Dec 2015
    Link to this post
    Hi Tim,

    Testing the sample seems works fine. Do you have any issues when open the products list in the backend (Ecommerce products)? Do you have the same issue when you get a list of other content types, e.g. News.

    In addition, where this code is executed, in any custom control?  If so, can you provide this control here or open a support ticket?

    Svetoslav Manchev
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
  3. tim
    tim avatar
    8 posts
    30 Nov 2015
    04 Jan 2016
    Link to this post

    Hi Svetoslav,

    Sorry for delay, been on vacation.

    Error does not happen when the object is referenced from a controller, it was only happening when I was unit testing the repository separately using Nunit. I am now calling the methods in the controller for testing and that appears to be working OK.


3 posts, 0 answered