Method NoNewInstances
NoNewInstances()
Defines that no new instances should exist when this definition is asserted using
MemAssertion.
xref:SciTech.NetMemProfiler.MemAssertion.Assert*.
Declaration
public AssertionsDefinition NoNewInstances()
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Calling MemAssertion.
xref:SciTech.NetMemProfiler.MemAssertion.Assert*
using this AssertionsDefinition will fail if a new instance exists, unless the type is also included in a call to an AllowXXX
or MaxXXX
method.
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
NoNewInstances(TypeSet)
Defines that no new instances of any type in the provided typeSet
should exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition NoNewInstances(TypeSet typeSet)
Parameters
Type | Name | Description |
---|---|---|
TypeSet | typeSet | A TypeSet containing the types of the instances that should be checked. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Calling MemAssertion.
MemAssertion.Assert
using this AssertionsDefinition will fail if a new instance of any type in the
typeSet
exists, unless the type is also included in a call to an AllowXXX
or MaxXXX
method.
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
NoNewInstances(Type[], Boolean)
Defines that no new instances of the provided types
(and optionally
their subclasses) should exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition NoNewInstances(Type[] types, bool includeSubclasses)
Parameters
Type | Name | Description |
---|---|---|
System.Type[] | types | An array containing the System.Types that should be checked. |
System.Boolean | includeSubclasses | Indicates whether instances of subclasses of the specified type should be checked. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Calling MemAssertion.
MemAssertion.Assert
using this AssertionsDefinition will fail if a new instance of the provided types (and optionally
their subclasses) exists, unless the type is also included in a call to an AllowXXX
or MaxXXX
method.
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
NoNewInstances(Type[])
Defines that no new instances of the provided types
should exist when this
definition is asserted using MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition NoNewInstances(Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System.Type[] | types | An array containing the System.Types that should be checked. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Calling MemAssertion.
MemAssertion.Assert
using this AssertionsDefinition will fail if a new instance of the provided types exists, unless the
type is also included in a call to an AllowXXX
or MaxXXX
method.
note
The AllowXXX
(AllowInstances, AllowNewInstances) and
MaxXXX
(MaxInstances, MaxNewInstances,
MaxBytes, MaxNewBytes) methods takes
precedence over the NoXXX
(NoInstances, NoNewInstances) methods.
For more information see AssertionsDefinition.
NoNewInstances(Type, Boolean)
Defines that no new instances of the provided type
(and optionally
its subclasses) should exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition NoNewInstances(Type type, bool includeSubclasses)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The System.Type of the instances that should be checked. |
System.Boolean | includeSubclasses | Indicates whether instances of subclasses of the specified type should be checked. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Calling MemAssertion.
MemAssertion.Assert
using this AssertionsDefinition will fail if a new instance of the provided type (and optionally
its subclasses) exists, unless the type is also included in a call to an AllowXXX
or MaxXXX
method.
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
NoNewInstances(Type)
Defines that no new instances of the provided type
should exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition NoNewInstances(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The System.Type of the instances that should be checked. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Calling MemAssertion.
MemAssertion.Assert
using this AssertionsDefinition will fail if a new instance of the provided type
exists, unless the type is also included in a call to an AllowXXX
or MaxXXX
method.
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
NoNewInstances(String[], Boolean)
Defines that no new instances of Types
that matches the provided names (and optionally
their subclasses) should exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition NoNewInstances(string[] typeNames, bool includeSubclasses)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | typeNames | An array containing the names of the |
System.Boolean | includeSubclasses | Indicates whether instances of subclasses of the specified types should be checked. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Calling MemAssertion.
MemAssertion.Assert
using this AssertionsDefinition will fail if a new instance of the provided types (and optionally
their subclasses) exists, unless the type is also included in a call to an AllowXXX
or MaxXXX
method.
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
note
The name of a Type
can end with the wildcard character '*',
which allows all types that starts with the specified text
to be matched. This can be used to include all types in a namespace
(e.g. “System.Windows.Forms.*” will include all types in
the System.Windows.Forms namespace).
NoNewInstances(String[])
Defines that no new instances of Types
that matches the provided names
should exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition NoNewInstances(string[] typeNames)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | typeNames | An array containing the names of the |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Calling MemAssertion.
MemAssertion.Assert
using this AssertionsDefinition will fail if a new instance of the provided types (and optionally
their subclasses) exists, unless the type is also included in a call to an AllowXXX
or MaxXXX
method.
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
note
The name of a Type
can end with the wildcard character '*',
which allows all types that starts with the specified text
to be matched. This can be used to include all types in a namespace
(e.g. "System.Windows.Forms.*" will include all types in
the System.Windows.Forms namespace).
NoNewInstances(String, Boolean)
Defines that no new instances of the Types
that matches the provided name (and optionally
their subclasses) should exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition NoNewInstances(string typeName, bool includeSubclasses)
Parameters
Type | Name | Description |
---|---|---|
System.String | typeName | An array containing the type names of the instances that should be checked. |
System.Boolean | includeSubclasses | Indicates whether instances of subclasses of the specified types should be checked. |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Calling MemAssertion.
MemAssertion.Assert
using this AssertionsDefinition will fail if a new instance of a type that matches the provided name (and optionally
its subclasses) exists, unless the type is also included in a call to an AllowXXX
or MaxXXX
method.
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
note
The name of the Type
can end with the wildcard character '*',
which allows all types that starts with the specified text
to be matched. This can be used to include all types in a namespace
(e.g. “System.Windows.Forms.*” will include all types in
the System.Windows.Forms namespace).
NoNewInstances(String)
Defines that no new instances of the Types
that matches the provided name
should exist when this definition is asserted using
MemAssertion.
MemAssertion.Assert.
Declaration
public AssertionsDefinition NoNewInstances(string typeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | typeName | The type name of the instances |
Returns
Type | Description |
---|---|
AssertionsDefinition | Returns |
Remarks
Calling MemAssertion.
MemAssertion.Assert
using this AssertionsDefinition will fail if a new instance of a type that matches the provided name
exists, unless the type is also included in a call to an AllowXXX
or MaxXXX
method.
note
The AllowXXX
(AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX
(MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX
(NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.
note
The name of the Type
can end with the wildcard character '*',
which allows all types that starts with the specified text
to be matched. This can be used to include all types in a namespace
(e.g. “System.Windows.Forms.*” will include all types in
the System.Windows.Forms namespace).