Documentation

Documentation
V5 Documentation

NCrunch.Framework.MethodDataLimitAttribute

NCrunch.Framework Attribute Introduced NCrunch v5.0

Purpose

This attribute controls the RDI method data limit for the associated test(s). It can be applied at assembly, fixture or test level.

The method data limit assigned by this attribute will override any data limit assigned by config setting.

Declaration In NCrunch.Framework.dll

namespace NCrunch.Framework
{
    public class MethodDataLimitAttribute: Attribute
    {
        public MethodDataLimitAttribute(int methodDataLimitInBytes)
        {
            Value = methodDataLimitInBytes;
        }

        public int Value
        {
            get; private set;
        }
    }
}

You can declare this in your own code if you want NCrunch to use it - or otherwise reference the attribute from NCrunch.Framework.dll.

Usage example

[NCrunch.Framework.MethodDataLimit(int.MaxValue)]
[Test]
public void MyTest()
{
	...

Recommendations

The most common use of this attribute is to temporarily disable RDI's method data limit to make it easier to troubleshoot a failing test. When the data limit is disabled, all RDI data becomes available for the entire test run, making troubleshooting much easier. When this is done, the test will usually take longer to run and will require more disk space for its log.

Changing this setting has significant implications for RDI's disk space consumption. The RDI method data limit is RDI's most important limit for keeping collected data within reasonable limits. If the method data limit is disabled, a test log can potentially expand until it reaches the storage data limit.

Increasing the method data limit will allow RDI to collect more frames for each method, expanding the amount of data that is searchable and browsable in the RDI overlay. This can also cause tests to execute slower, as once the limit is reached, collection will shut down, reducing the cost of collection on test execution speed.

The behaviour of this setting can be overridden for specific code regions using the method data limit inline directive.

Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download