Common Build Problems

Class Does Not Contain (Member) Definition

Name Does Not Exist

No Method Takes <#> Arguments

Property Is Not Supported

Type/Namespace Could Not Be Found or Does Not Exist

Class Does Not Contain (Member) Definition

If you are trying to use a property that requires special syntax (the get- or set-accessor), you’ll get an error message that looks like this:

Compiler Error CS0117:
'type' does not contain a definition for 'identifier'

Solution

There are two situations when you need to use the get- or set-accessor syntax for properties:

• If the property uses different classes or data types for getting vs. setting (see Implementation Differences for Properties)

• If the property takes input arguments (see Properties with Input Arguments)

You can check the C# Syntax section in the reference section which displays the correct syntax to use. In addition, you can use the ObjectBrowser or the auto-complete features in Visual Studio .NET.

Name Does Not Exist

If the enum or string constant is not prefixed with its module name, you’ll get an error message that looks like this:

Compiler Error CS0103:
The name 'identifier' does not exist in the current context

Solution

For enums, you must include the module name. For example:

siMenuAnchorPoints.siMenuTbGetPrimitiveCurveID
siToolbarControl.siTBCtrlBlankSeparator
siImageBitDepth.siImageBitDepthFloat16
siClassID.siGeometryID
// etc.

For string constants, you must use StringModule. For example:

StringModule.siBendOpType
StringModule.siCurveFilter
StringModule.siLocalType
StringModule.siUIButtonDisable
// etc.

 

To find the name of a module for a given enum or constant, type the name of the enum value into the Index keyword box in the SDK Documentation (Help > SDK Guides in XSI).

Each enum and constant page also provides the full name of each value for C# at the top of the page.

No Method Takes <#> Arguments

If you omit an optional argument when calling an object model method you’ll get an error message that looks like this:

Compiler Error CS1501
No overload for method 'method' takes 'number' arguments

Solution

Check the number of arguments the method takes and verify whether you are missing any arguments.

 

All arguments must be explicitly passed, regardless of whether they are optional for scripting or not.

Property Is Not Supported

If you used a property which requires different data types or classes for getting vs. setting (such as Preferences.Categories or XSIApplication.ActiveProject), you’ll get an error message that looks like this:

Compiler Error CS1545:
Property, indexer, or event 'property' is not supported by the language; try directly calling accessor methods 'set accessor' or 'get accessor'

Solution

In some cases, an alternative method or property exists that resolves the problem; for example, XSIApplication.ActiveProject2 is an alternative property which returns and sets a Property object.

In cases where there are no alternative methods or properties, use the accessor method associated with the property. The accessor method can be called by prefixing get_ and set_ to the name of the property:

// Raises compiler error CS1545:
Preferences pref = xsi.Preferences;
ProjectItemCollection proj_itms = pref.Categories; 

// Special syntax as a workaround 
ProjectItemCollection proj_itms = pref.get_Categories;
pref.set_Categories( proj_itms );

 

For more information, see Implementation Differences for Properties.

Type/Namespace Could Not Be Found or Does Not Exist

If the XSI Object Model assemblies were not properly installed or referenced or you forgot to reference them with the using directive, you’ll get an error message that looks like this:

Compiler Error CS0246:
The type or namespace name 'type/namespace' could not be found (are you missing a using directive or an assembly reference?)

or

Compiler Error CS0234:
The type or namespace name 'name' does not exist in the namespace 'namespace' (are you missing an assembly reference?)

Solution

Verify whether the following directives appear in your .cs source file (the plug-in wizards include them automatically):

using XSIOM; // XSI object model
using XSIMath;
using XSIUtil;

If they do appear, most likely the assemblies have not been either referenced or installed properly. Open the References folder in the Solution Explorer:

 

If the assembly you are trying to use is not in the list you can right-click to add a reference to the assembly. If it is in the list then it is possible that it has not been installed properly.

To find out whether the XSI assemblies are installed you can run these commands from the XSI command prompt:

gacutil /l Softimage.XSIOM
gacutil /l Softimage.XSIUtil
gacutil /l Softimage.XSIMath

 

The Global Assembly Cache Utility (gacutil) comes with the .NET Framework SDK, which you will have to install to use this tool.

If they have been properly installed, you will see something like this:

The Global Assembly Cache contains the following assemblies:
   Softimage.XSIMath, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a90401fcf6bc5571, processorArchitecture=MSIL
Number of items = 1

The Global Assembly Cache contains the following assemblies:
   Softimage.XSIUtil, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a90401fcf6bc5571, processorArchitecture=MSIL
Number of items = 1

The Global Assembly Cache contains the following assemblies:
   Softimage.XSIMath, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a90401fcf6bc5571, processorArchitecture=MSIL
Number of items = 1

If they haven’t been properly installed, this message appears:

The Global Assembly Cache contains the following assemblies:

Number of items = 0

To install the XSI assemblies, open an XSI command prompt (it automatically opens at the Application/bin directory under the factory location) and enter the following three commands:

gacutil /i Softimage.XSIOM.dll
gacutil /i Softimage.XSIUtil.dll
gacutil /i Softimage.XSIMath.dll

If the installation was successful, you will see the following message:

Assembly successfully added to the cache

 



SOFTIMAGE|XSI v6.01     

Return to Softimage XSI Index