Rider: "The test was run without the support for dotMemory Unit"

I'm trying to run the example tests in the dotMemory Unit documentation, however I'm getting this exception:

DotMemoryUnitException
The test was run without the support for dotMemory Unit. To safely run tests with or without (depending on your needs) the support for dotMemory Unit:
- Set 'DotMemoryUnitAttribute.FailIfRunWithoutSupport' to 'False'. In this case, if a test is run without the support for dotMemory Unit, all 'dotMemory.Check' calls will be ignored.
- If you use the 'dotMemoryApi' class to work with memory, wrap all dotMemoryApi calls that get data for assertions with the 'dotMemoryApi.IsEnabled' check.

I've checked the IsEnabled property and it is indeed disabled.

What do I need to do to enable this?

 

2 comments
Comment actions Permalink

Ah, just found it.  You have to actually click on the specific test's icon and choose "run under dotmemory unit".

Is this the only way?  I'd have to run each class manually in the IDE to have a full run this way.

1
Comment actions Permalink

David,

If you want to run unit test which uses dotMemory Unit calls without dotMemory Unit support, you should set DotMemoryUnitAttribute.FailIfRunWithoutSupport to False or check for dotMemoryApi.IsEnabled in test code before calling dotMemoryApi methods.

For example, if you use dotMemory  class or [AssertTraffic] attribute:
[assembly: DotMemoryUnit(FailIfRunWithoutSupport = false)]

If you use dotMemoryApi class:

if (dotMemoryApi.IsEnabled)

{

\\code with dotMemoryApi calls

}

Tests fail if you run them without dotMemory Unit support  by default to avoid the case when customer runs memory tests such way and expects that all memory assertions passes but actually it doesn't.

0

Please sign in to leave a comment.