STARIONGROUP / COMET-IME-Community-Edition

The Concurrent Design Desktop Application and Excel Integration compliant with ECSS-E-TM-10-25 Annex A and Annex C
https://www.stariongroup.eu
Other
23 stars 5 forks source link

Sheet generators do not work on JSON file-based data source #732

Open cozminvelciu opened 3 years ago

cozminvelciu commented 3 years ago

Prerequisites

Description

Sheet generators (Crossview, Parameter, etc.) fail silently when using a JSON file-based data source.

Steps to Reproduce

  1. Connect to a JSON file-based data source
  2. Open a model
  3. Attempt to generate any of the sheets (Crossview, Parameter, etc.)
  4. The generation will fail silently with no user feedback regarding the error, other than a generic error in the Excel status bar in the lower left hand side corner: "Rebuild Parameter/Crossview sheet failed"

Logs

Stacktraces dredged up in development mode, due to no error reporting on sheet generation:

Parameter sheet:

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=CDP4JsonFileDal
  StackTrace:
   at CDP4JsonFileDal.JsonFileDal.<Read>d__22`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at CDP4Dal.Session.<Update>d__60.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at CDP4Dal.Session.<Refresh>d__54.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at CDP4ParameterSheetGenerator.WorkbookOperator.<RefreshSessionData>d__10.MoveNext() in C:\Users\Cozmin Velciu\Documents\Repositories\RHEA\CDP4-IME-Community-Edition\CDP4ParameterSheetGenerator\WorkbookOperator.cs:line 222
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at CDP4ParameterSheetGenerator.WorkbookOperator.<Rebuild>d__9.MoveNext() in C:\Users\Cozmin Velciu\Documents\Repositories\RHEA\CDP4-IME-Community-Edition\CDP4ParameterSheetGenerator\WorkbookOperator.cs:line 185

Crossview sheet:

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=CDP4JsonFileDal
  StackTrace:
   at CDP4JsonFileDal.JsonFileDal.<Read>d__22`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at CDP4Dal.Session.<Update>d__60.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at CDP4Dal.Session.<Refresh>d__54.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at CDP4CrossViewEditor.WorkbookOperator.<RefreshSessionData>d__6.MoveNext() in C:\Users\Cozmin Velciu\Documents\Repositories\RHEA\CDP4-IME-Community-Edition\CDP4CrossViewEditor\WorkbookOperator.cs:line 193
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at CDP4CrossViewEditor.WorkbookOperator.<Rebuild>d__5.MoveNext() in C:\Users\Cozmin Velciu\Documents\Repositories\RHEA\CDP4-IME-Community-Edition\CDP4CrossViewEditor\WorkbookOperator.cs:line 156

The error is caused by a call to await session.Refresh() on a JsonFileDal.

cozminvelciu commented 3 years ago

This is another example why having error reporting in sheet generation is critical (#709), as finding the problem was pure luck insofar as it could be easily reproduced in development mode.

lxatstariongroup commented 3 years ago

@alexatrhea Please propose a solution

lxatstariongroup commented 3 years ago

@samatrhea Do we fix this in SDK: ISession.Refresh doesn't thow anymore for JSONDal, or do we fix in the IME where we catch the thrown error and just ignore it for this specific case?

lxatstariongroup commented 3 years ago

@samatrhea What to do with this?