Server API - Problems with ActionSite ID

(imported topic written by SystemAdmin)

Interesting anomaly. The session relevance in my x64 lab installation of TEM 8.1.617:

id of bes sites whose (name of it = “ActionSite”)

returns: 2147498578

When I download the TakeActionFromFixlet.cs example and modify it to use the bes site id returned above, I get the following error in Visual Studio:

int siteID = 2147498578;

Cannot implicitly convert type ‘uint’ to ‘int’. An explicit conversion exists (are you missing a cast?)

If I try to cast the “yes, this is too large for an int” value, I get the expected exception:

int siteID = Convert.ToInt32(2147498578);

Value was either too large or too small for an Int32.

And as a side note, the vanilla c# code in the TakeActionFromFixlet.cs example:

int siteID = -2147481618;

int fixletID = 32;

int action = 0;

BESAPILib.FixletMessage fixlet = new BESAPILib.FixletMessage();

fixlet.Load( siteID, fixletID, username, password );

if ( fixlet.DiagnosticMessage.Length != 0 )

throw new Exception( fixlet.DiagnosticMessage );

returns the following error:

NoSuchSiteID: 2147485678

So some cool overflowing of int values is occurring, but the example is still broken. What am I missing here?

Thanks!

(imported comment written by SystemAdmin)

Chris.Luther

int siteID = 2147498578;

Here is the solution:

int siteID = (int)Convert.ToInt64(2147498578);

Kudos to Jimmy G. for showing me this convoluted way to take a literal UInt32 value and force a controlled Int32 overflow to occur. The end result is siteID is set to -2147468718.

It still does not explain why IFixletMessage.Load() takes Int32 values for siteID and fixletID, while IXMLImporter.ImportAction() takes UInt32 values for siteID and fixletID.

In any event, my problems are solved.