When testing after adding new entities, the initialize database function repeats itself on every try which then other difficult errors

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
I've added some new entities, so I'm trying to make sure everything is working ok.  For some reason I've been getting weird errors when adding 'settings' (in the InstallationService.cs area initially with the PDFsettings), but now after tracing though it it no longer fails. but now I'm find out that the initialize functions repeats itself on every try until it's done.  The problem with that is that it causes duplicate entries in the database which then cause more difficult find errors such as this last one.

•Setup failed: System.InvalidOperationException: Sequence contains more than one element at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source) at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__3[TResult](IEnumerable`1 sequence) at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot) at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression) at System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression) at System.Linq.Queryable.Single[TSource](IQueryable`1 source) at Nop.Services.Installation.InstallationService.InstallSettings() in C:\Users\Bernie\Documents\WhiteOak\nopCommerceR3Software\Libraries\Nop.Services\Installation\InstallationService.cs:line 4531 at Nop.Services.Installation.InstallationService.InstallData(String defaultUserEmail, String defaultUserPassword, Boolean installSampleData) in C:\Users\Bernie\Documents\WhiteOak\nopCommerceR3Software\Libraries\Nop.Services\Installation\InstallationService.cs:line 9391 at Nop.Web.Controllers.InstallController.Index(InstallModel model) in C:\Users\Bernie\Documents\WhiteOak\nopCommerceR3Software\Presentation\Nop.Web\Controllers\InstallController.cs:line 435

This is because now the language table has dups of 'English'

I've now spent half a day trying to sort this out.  I seems that if you are gonig through initilization of database, that it should first clear all the tables before trying to add entries again.  Otherwise you can get some mighty weird errors especially if you are not experience in the code.  I recommend this be fixed as a bug.

Bernie
12 years ago
Ok I found out what is going on.  If you are testing (in debug mode) and creating a new database and you get a failure on the window where you specifiy the database etc, it does no good to retry the operation after having set break points.  You will get random and unrepeatable results.  So if you are debugging that you would restart the debug session on every try.  Apparently things are being left in an unknow state so that when retrying the operation you will known results (strange exceptions etc)

Bernie
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.