Refresh Relational Model aborts.

Posts   
 
    
bobperritt
User
Posts: 14
Joined: 05-Aug-2004
# Posted on: 21-Jul-2010 03:28:54   

Using the same LLBL project I sent, the following exception happens very often if the database schema changes (adding columns, rename, etc.) I think it is caused of there is a typed view from a stored proc or table and the table/proc changes.

Exception information.

LLBLGen Pro version: v3.0. Build: July 6th, 2010

Exception details:

Message: Object reference not set to an instance of an object. Source: SD.LLBLGen.Pro.ApplicationCore Stack trace: at SD.LLBLGen.Pro.ApplicationCore.MetaData.CatalogRefresher.<MigrateTypedViews>b__4(KeyValuePair2 kvp) at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at SD.LLBLGen.Pro.ApplicationCore.MetaData.CatalogRefresher.MigrateTypedViews() at SD.LLBLGen.Pro.ApplicationCore.MetaData.CatalogRefresher.MigrateProjectToNewCatalog() at SD.LLBLGen.Pro.ApplicationCore.MetaData.DatabaseMetaData.RefreshMetaData(IEnumerable1 populatedCatalogs, LogNode refreshLogNode, Project containingProject, UserConfiguration preferences) at SD.LLBLGen.Pro.ApplicationCore.MetaData.MetaDataStore.RefreshMetaData(String driverID, IEnumerable1 populatedCatalogs, Project containingProject, UserConfiguration preferences) at SD.LLBLGen.Pro.ApplicationCore.ProjectClasses.Project.RefreshMetaData(String driverID, List1 populatedCatalogs, UserConfiguration preferences) at SD.LLBLGen.Pro.Gui.Classes.GuiController.PerformRefreshMetaDataAction(String driverID) at SD.LLBLGen.Pro.Gui.Controls.CatalogExplorer._commandManager_CommandClick(Object sender, CommandEventArgs e) at Janus.Windows.UI.CommandBars.UICommandCollection.c(Object , CommandEventArgs ) at Janus.Windows.UI.CommandBars.UICommand.ar() at Janus.Windows.UI.Internal.JNSCZ.OnMouseUp(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at Janus.Windows.UI.Internal.JNSCZ.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Inner exception: <null>

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 21-Jul-2010 10:08:39   

I'm sorry I can't reproduce this.

Can you please create a repro project using Northwind, and then write the steps for us to follow to be able to reprodue this exception.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 21-Jul-2010 12:55:12   

Please download the latest build. You're on a july 6th build. We fixed some issues in the refresher recently.

Frans Bouma | Lead developer LLBLGen Pro
bobperritt
User
Posts: 14
Joined: 05-Aug-2004
# Posted on: 21-Jul-2010 13:25:21   

Thank you - I'll download the latest build. I verified if I remove any typed views, the refresh seems to work. May have had to remove a mapped entity as well.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 21-Jul-2010 14:03:54   

bobperritt wrote:

Thank you - I'll download the latest build. I verified if I remove any typed views, the refresh seems to work. May have had to remove a mapped entity as well.

We're not black-art wizards, Bob wink . If the problem still exists in the latest build, please provide us with material to reproduce it. Thanks.

(edit). Analyzing the code now, I'll see if I can find any problem in that particular method.

The code which appears to fail is this:

Dictionary<TypedViewDefinition, GroupableModelElementMapping> allTypedViewsWithMappings =
                                                    _currentProject.GetAllTypedViewsWithTheirMappingsForDatabase(_refreshedCatalog.UsedDriverID);
// all entities which have a mapping to a target in the refreshed catalog is an entity to migrate. 
List<TypedViewDefinition> typedViewsToMigrate = (from kvp in allTypedViewsWithMappings
                                                where (kvp.Value.MappedTarget.ContainingSchema.ParentCatalog == _refreshedCatalog)
                                                select kvp.Key).ToList();

The problem is: a refresh only happens if the project is valid, so everything has a mapping, and is OK. This can only fail if something is NOT ok, but that also would mean the validation fails.

Very strange issue, I can't think of a situation when this might occur, (also because it would mean 'kvp' is null, which is impossible as it's read from a dictionary which always either returns a keyvaluepair (so not null) or nothing at all.

So if you could provide us with more information, that would be great.

Frans Bouma | Lead developer LLBLGen Pro
bobperritt
User
Posts: 14
Joined: 05-Aug-2004
# Posted on: 22-Jul-2010 18:03:39   

I added a new column to the output of stored procedures, 1st SP = InvoiceDetails. The SP was used to create typed view: UMT_TV_InvoiceDetails.

Exception information.

LLBLGen Pro version: v3.0. Build: July 16th, 2010

Exception details:

Message: Object reference not set to an instance of an object. Source: SD.LLBLGen.Pro.ApplicationCore Stack trace: at SD.LLBLGen.Pro.ApplicationCore.MetaData.CatalogRefresher.<MigrateTypedViews>b__4(KeyValuePair2 kvp) at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at SD.LLBLGen.Pro.ApplicationCore.MetaData.CatalogRefresher.MigrateTypedViews() at SD.LLBLGen.Pro.ApplicationCore.MetaData.CatalogRefresher.MigrateProjectToNewCatalog() at SD.LLBLGen.Pro.ApplicationCore.MetaData.DatabaseMetaData.RefreshMetaData(IEnumerable1 populatedCatalogs, LogNode refreshLogNode, Project containingProject, UserConfiguration preferences) at SD.LLBLGen.Pro.ApplicationCore.MetaData.MetaDataStore.RefreshMetaData(String driverID, IEnumerable1 populatedCatalogs, Project containingProject, UserConfiguration preferences) at SD.LLBLGen.Pro.ApplicationCore.ProjectClasses.Project.RefreshMetaData(String driverID, List1 populatedCatalogs, UserConfiguration preferences) at SD.LLBLGen.Pro.Gui.Classes.GuiController.PerformRefreshMetaDataAction(String driverID) at SD.LLBLGen.Pro.Gui.Controls.CatalogExplorer._commandManager_CommandClick(Object sender, CommandEventArgs e) at Janus.Windows.UI.CommandBars.UICommandCollection.c(Object , CommandEventArgs ) at Janus.Windows.UI.CommandBars.UICommand.ar() at Janus.Windows.UI.Internal.JNSCZ.OnMouseUp(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at Janus.Windows.UI.Internal.JNSCZ.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Inner exception: <null>

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 22-Jul-2010 21:37:50   

Thanks for the attached project - we'll look at reproducing your issue.

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 23-Jul-2010 10:15:19   

Without the db script of the database system (so we can do a refresh) we can't reproduce this. Please generate the database create script from your database (so if you're using sqlserver, do that inside sql server management studio, by including tables, views, user defined functions, do that by right-clicking the catalog -> tasks -> generate scripts...) .

You can email us that script instead of attaching it, by emailing it to: support AT llblgen DOT com, so we can create a database with that script and with your project we can refresh that project with the updated database and should run into the problem you run into as well.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 23-Jul-2010 15:35:19   

I've altered the behavior for refreshing typedviews mapped on proc results: if the proc result was not equal, the view was simply unmapped. I've changed this now to: it first finds in the list of proc results which resultset matches, and if none found (e.g. a field was added/ removed) the resultset with the same name (which is artificial, so if it was mapped onto the first resultset, it's now again mapped onto the first resultset).

This should fix your problem. I also couldn't reproduce the crash.

I'll attach a new applicationcore dll for you to test. Copy this dll as administrator into the llblgen pro installation folder.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 23-Jul-2010 16:19:24   

Fix works (feedback reported by email). Good simple_smile

Frans Bouma | Lead developer LLBLGen Pro