ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
AMAngus McLeod19/02/2014

I have come to a standstill while going through the EPDM API "Set Revisions" example in the API Fundamentals book.

I am writing the examples in C# even though they are presented in VB. I presume that these examples should work in both languages.

Error as follows:

"An unhandled exception of type 'System.ArgumentException' occurred in EPDM_SetRevision.exe

Additional information: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"

The error seems to occur when calling the "SetRevisionCounters(fileObj.ID, revCounters)" method. See code below...

     ...

     // Assign the new revison counter value to the value stored in the Revision card variable

     // converted to an integer.

     long revInt = Strings.Asc(revisionProp.ToUpper()) - Strings.Asc("A") + 1;

     revCounters[0].mlCounter = (int)revInt;

     // Set the revision counter to the new values.

     revMgr.SetRevisionCounters(fileObj.ID, revCounters);

     // Set the revision of the file to the new values.

     revMgr.IncrementRevision(fileObj.ID);

     ...

Debug output:

...

A first chance exception of type 'System.ArgumentException' occurred in EPDM_SetRevision.exe

An unhandled exception of type 'System.ArgumentException' occurred in EPDM_SetRevision.exe

Additional information: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

The program '[4748] EPDM_SetRevision.vshost.exe: Managed (v4.0.30319)' has exited with code -1 (0xffffffff).

Method prototype (COM):

HRESULT SetRevisionCounters( [in] long lFileID,
                             [in] SAFEARRAY ( struct EdmRevCounter ) poCounters );

Displays in VS2012 (C#) as:

void SetRevisionCounters(int lFileID, Array poCounters);

Has this happened to anyone else before? Any help would be most appreciated.

I am running EPDM and Solidworks 2013 and developing in Visual Studio Express 2012.

Am using WPF for my launch application.

Cheers