Search code examples
c#unit-testingxunitdotmemory

The workspace you are trying to open is incompatible with the current dotMemory version


I have created a new XUnit Tests Project with .Net 5 target framework with one test class

public class SomeTests
{
    private readonly ITestOutputHelper output;

    public SomeTests(ITestOutputHelper output)
    {
        this.output = output;
        DotMemoryUnitTestOutput.SetOutputMethod(output.WriteLine);
    }

    [Fact]
    [DotMemoryUnit(CollectAllocations = true)]
    public void SomeTest()
    {
        var beforeTestMethodPoint = dotMemory.Check();
        var allocatedArray = new string[10];
        dotMemory.Check(afterTestMethodPoint => Assert.True(afterTestMethodPoint.GetTrafficFrom(beforeTestMethodPoint).AllocatedMemory.SizeInBytes == 0));
    }
}

NuGet package installed is JetBrains.DotMemoryUnit 3.1.20200127.214830

After running the test (run under dotMemory Unit) the following output is created

Xunit.Sdk.TrueException
Assert.True() Failure
Expected: True
Actual:   False
   at TestsDotMemory.SomeTests.<>c__DisplayClass2_0.<SomeTest>b__0(Memory afterTestMethodPoint) in SomeTests.cs:line 25
   at JetBrains.dotMemoryUnit.dotMemory.Check(Action`1 check)
   at TestsDotMemory.SomeTests.SomeTest() in SomeTests.cs:line 25


[dotMemory Unit]: The workspace is saved to "file:///C:/Users/username/AppData/Local/Temp/dotMemoryUnitWorkspace/Run-2021-03-06T10-15-06.288/SomeTest.2021-03-06T10-15-11.629.dmw". (File size: 9 MB)

When I click on link with .dmw file dotmemory application is opened

The current application version and license information

JetBrains dotMemory 2020.3.3 Build 203.0.20210217.101844 built on 2021-02-17
dotMemory 2020.3.20210217.101844
dotMemory 2020.3.3 free trial period is running. 2 days left.

and dialog window appears

The workspace you are trying to open is incompatible with the current dotMemory version. Do you want to open the workspace in a compatible portable dotMemory version?

If I select yes, then dotMemory 2019.1.3 is opened with a dialog about license information is over (my license is only for 2020.3)

So why dotMemory 2020.3.3 is not supported the .dmw file ?


Solution

  • .dmw file format is often changed in order to provide users new functionality. Unfortunatelly dotMemory Unit produces a workspace in older format because the new version was not released for several years. As far as I see you don't have a license for dotMemory 2020.3, you use the trial period. Whereas the trial period for dotMemory 2019.1.3 is over on your machine. Paid license for any version of dotMemory definitely covers all the previous versions.