VAF Pre-Condition throwing error instead of showing message

Hi 

I've setup a Precondition on one of the states in a workflow in my VAF code. When it fails one of the conditions I am setting string message and returning false. I've debugged the code and it throws the below error, straight after the return.

I thought it could be an issue with the older version of the MFiles.VAF package I was using (22.12.672.3) but have since updated to 24.1.706.3 and having the same issue.

Have I misconfigured this precondition method?

<MetadataEditor>, -, Input string was not in a correct format. (0x80131537)
ScriptErrorHelper.cpp, 96, Input string was not in a correct format. (0x80131537)
MDispatchExImpl.h, 679, Input string was not in a correct format. (0x80131537)
MDispatchExImpl.h, 841, Input string was not in a correct format. (0x80131537)
CoDynamicCLRObjectWrapper.cpp, 552, Input string was not in a correct format. (0x80131537)
CoDynamicCLRObjectWrapper.cpp, 322, Input string was not in a correct format. (0x80131537)
ManagedError.cpp, 149, Input string was not in a correct format. (0x80131537)
CWFinance.VAF 0.2.4: [CManagedError* CRuntimeObjectWrapper.Invoke(CRuntimeObjectWrapper*, CManagedError*, CCoDynamicCLRObjectWrapper*, Int32, _GUID*, UInt32, UInt16, tagDISPPARAMS*, tagVARIANT*, tagEXCEPINFO*, UInt32*)], IL:197, Input string was not in a correct format. (0x80131537)
CWFinance.VAF 0.2.4: [Boolean CRuntimeObjectWrapper.ProcessFieldPut(CRuntimeObjectWrapper*, CCoDynamicCLRObjectWrapper*, Int32, tagDISPPARAMS*, tagVARIANT*)], IL:107, Input string was not in a correct format. (0x80131537)
CWFinance.VAF 0.2.4: [Void CRuntimeObjectWrapper.ConvertInputParameters(CRuntimeObjectWrapper*, tagDISPPARAMS*, System.Reflection.ParameterInfo[], System.Type, System.Object[]*, System.Object*)], IL:447, Input string was not in a correct format. (0x80131537)
CWFinance.VAF 0.2.4: [System.Object CRuntimeObjectWrapper.ConvertType(CRuntimeObjectWrapper*, System.Object, System.Type)], IL:28, Input string was not in a correct format. (0x80131537)
CWFinance.VAF 0.2.4: [System.Object ChangeType(System.Object, System.Type, System.IFormatProvider)], IL:282, Input string was not in a correct format. (0x80131537)
CWFinance.VAF 0.2.4: [Int32 System.IConvertible.ToInt32(System.IFormatProvider)], IL:0, Input string was not in a correct format. (0x80131537)
CWFinance.VAF 0.2.4: [Int32 ParseInt32(System.String, System.Globalization.NumberStyles, System.Globalization.NumberFormatInfo)], IL:32, Input string was not in a correct format. (0x80131537)
CWFinance.VAF 0.2.4: [Void StringToNumber(System.String, System.Globalization.NumberStyles, NumberBuffer ByRef, System.Globalization.NumberFormatInfo, Boolean)], IL:92, Input string was not in a correct format. (0x80131537)
(M-Files 24.2.13421.8 2024-03-07T03:14:57.115Z)

Parents Reply Children
  • Hi Radu,

    Thanks for the reply. My issue here is this is now in MFiles managed code unless someone can provide me with something I've done wrong. I set the message out string and returned false as should be done in a VAF state Precondition. That message string is supposed to be passed back to the user so they know why the object failed to pass into the new state. instead they're getting "Input string not in correct format".

  • the issue is not with the string you want to show to user.

    The issue is with your code at some point you are trying to convert a string to an int, and the string does not look like an int!

  • I also don't think that the error shown here is directly related to the code snippet you provided.  If you remove the pre-condition then do you still get the error?

    The error stack doesn't give a particularly useful set of data, I admit.  It seems to be in the "CWFinance.VAF" (version 0.2.4); is that the application you're building?  If so do you call any method called "StringToNumber" anywhere in that codebase (outside of the precondition)?

    If so could that bit of code being called here and not have the data that it's anticipating?

  • Hi Radu,

    At no point is my code doing a string to int conversion.

  • Hi Craig,

    I've included the full Pre-Condition. The red arrow indicates where it fails during debugging, after stepping past the return false.

    If I remove the pre-condition, it simply completes the state action without issue, so the error only occurs upon returning a false from pre-condition.

    CWFinance.VAF (0.2.4) is my application, there is no StringToNumber method anywhere in the codebase. There is no string to int conversion of any type in the code base. That's why the error doesn't make any sense to me because it doesn't seem to relate to anything in the codebase.