ClrAppDomain Property

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

The ClrAppDomain property returns an AppDomain object that provides access to the application domain containing the given object. You can use the AppDomain object to determine the .NET runtime version of the object and the name of its application domain and access namespaces, classes and class members in assemblies loaded into this domain.

Declaration

TestObj.ClrAppDomain

Read-Only Property Object
TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section

Applies To

All .NET and WPF application objects.

View Mode

To view this property in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Property Value

An AppDomain object corresponding to the application domain that the object belongs to.

This object is a wrapper over the .NET Framework AppDomain object. For more information about the object and its properties and methods, see the AppDomain Class article in the MSDN library.

Remarks

The ClrAppDomain property is available only if the .NET Application Support plugin is installed and enabled and the application under test is a .NET application created with the Microsoft Windows Forms or Borland VCL.NET library or a WPF application. Otherwise, this property is not on an object’s property list.

Example

The following example demonstrates how to use the ClrAppDomain property to get the .NET runtime version used by an object in a .NET application:

JavaScript, JScript

function Test()
{
  var obj = Sys.Process("Orders").WinFormsObject("MainForm");
  var strVer = obj.ClrAppDomain.ClrVersion;
  Log.Message(strVer);
}

Python

def Test():
  obj = Sys.Process("Orders").WinFormsObject("MainForm")
  strVer = obj.ClrAppDomain.ClrVersion
  Log.Message(strVer)

VBScript

Sub Test
  Dim obj, strVer
  Set obj = Sys.Process("Orders").WinFormsObject("MainForm")
  strVer = obj.ClrAppDomain.ClrVersion
  Log.Message strVer
End Sub

DelphiScript

procedure Test;
var obj, strVer;
begin
  obj := Sys.Process('Orders').WinFormsObject('MainForm');
  strVer := obj.ClrAppDomain.ClrVersion;
  Log.Message(strVer);
end;

C++Script, C#Script

function Test()
{
  var obj = Sys["Process"]("Orders")["WinFormsObject"]("MainForm");
  var strVer = obj["ClrAppDomain"]["ClrVersion"];
  Log["Message"](strVer);
}

See Also

AppDomain Object
ClrClassName Property
ClrFullClassName Property
Testing .NET Applications
Testing WPF Applications

Highlight search results