Sitecore.FakeDb icon indicating copy to clipboard operation
Sitecore.FakeDb copied to clipboard

Issue with Sitecore 9

Open davidnguyen opened this issue 5 years ago • 4 comments

Hi Sergey,

I'm trying Sitecore.FakeDb via NuGet v2.0.0-beta2 with Sitecore 9 update 3 and getting the following exception when trying to get the simplest test to work. System.NullReferenceException: Object reference not set to an instance of an object. Result StackTrace: at Sitecore.Configuration.DefaultFactory.CreateType(XmlNode configNode, String[] parameters, Boolean assert) at Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, Boolean assert) at Sitecore.Configuration.DefaultFactory.GetDatabase(String name, Boolean assert) at Sitecore.Configuration.DefaultFactory.GetDatabase(String name) at Sitecore.Configuration.Factory.GetDatabase(String name) at Sitecore.Data.Database.GetDatabase(String databaseName) at Sitecore.FakeDb.Db..ctor(String databaseName)

My app.config file has databaseType set to "Sitecore.Data.DefaultDatabase, Sitecore.Kernel" with the license file in place.

I can't seem to workout why at the moment, any secrete sauce I have to put in to make it tick with Sitecore 9?

Thanks

davidnguyen avatar Nov 15 '18 23:11 davidnguyen

Hi David,

Sitecore 9 Update 3?! I haven't seen that before... At least it's not publicly available yet. https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform.aspx On 16 лист. 2018, 01:17 +0200, David Nguyen [email protected], wrote:

Hi Sergey, I'm trying Sitecore.FakeDb via NuGet v2.0.0-beta2 with Sitecore 9 update 3 and getting the following exception when trying to get the simplest test to work. System.NullReferenceException: Object reference not set to an instance of an object. Result StackTrace: at Sitecore.Configuration.DefaultFactory.CreateType(XmlNode configNode, String[] parameters, Boolean assert) at Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, Boolean assert) at Sitecore.Configuration.DefaultFactory.GetDatabase(String name, Boolean assert) at Sitecore.Configuration.DefaultFactory.GetDatabase(String name) at Sitecore.Configuration.Factory.GetDatabase(String name) at Sitecore.Data.Database.GetDatabase(String databaseName) at Sitecore.FakeDb.Db..ctor(String databaseName) My app.config file has databaseType set to "Sitecore.Data.DefaultDatabase, Sitecore.Kernel" with the license file in place. I can't seem to workout why at the moment, any secrete sauce I have to put in to make it tick with Sitecore 9? Thanks — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

sshushliapin avatar Nov 16 '18 12:11 sshushliapin

I am having the same problem with Sitecore 9.1.

I have tried assembly binding redirect - no joy. The config seems correct for the Sitecore 9.1 DB. It only has a name parameter in the constructor

mikeedwards83 avatar Dec 12 '18 20:12 mikeedwards83

Hum interestingly the config in memory is:

<database id="master" type="Sitecore.Data.Database, Sitecore.Kernel" singleInstance="true"> <param desc="name">$(id) <dataProviders hint="list:AddDataProvider"> <dataProvider ref="dataProviders/main" /> <dataProvider ref="dataProviders/language" /> </dataProviders>

It seems that the DB type is not being updated based on the DB Type specified in the App.config.

mikeedwards83 avatar Dec 12 '18 20:12 mikeedwards83

Gah, the test runner wasn't copying the new App.config across after it had been changed. So the change of the DB type was not being picked up!

mikeedwards83 avatar Dec 12 '18 21:12 mikeedwards83