Flowmaster Internal error : "System.Reflection.TargetInvocationException: Exception has been thrown


Product(s):FlowMaster
Version(s):10.XX.XX.XX, 08.11.xx.xx
Area: Modeling

Problem

When opening a specific model in Flowmaster an internal error is generated with the following details. The error does NOT occur when opening other models, such as one of the included samples.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.OverflowException: Arithmetic operation resulted in an overflow.
at Haestad.Support.Support.HmIDCollection..ctor(Int32 capacity)
at Haestad.Domain.DataObjects.Dao.DaoSupportElementManagerDataBrokerBase.ElementIDs(Int32 domainDataSetID)
at Haestad.Domain.ModelingObjects.ModelingElementManagerBase.Elements()
...

Or...

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
...

Solution

For this model-specific case, the problem may be that the cached-counts and not synchronized. To fix this, follow these steps:

1) Make sure FlowMaster is closed
2) Browse to the folder where the model is stored
3) For V8i released products, open the .fm8.mdb file in a database program such as Microsoft Access. For CONNECT Edition products open the .fm8.sqlite in a database program such as SQLITE Expert Personal.
4) Open the "HMIElementTypeCount" table
5) Look at the "Count" column and replace any negative values with zeros.
6) Close the database and open the model in FlowMaster. If you have version 08.11.00.03 or greater, please go to Tools > Database Utilities > Update database cache

If this does not help, try the following:

1) Open the program without opening the model file.
2) Go to Tools > Database Utilities > Compact Database.
3) When the Open menu appears, select the .mdb / .sqlite file.
4) The Database file will be compacted and updated.
5) Once this process is complete, reopen the model file.