Test host process crash when running multiple tests

Hi,

I am developing my custom rhino plugin and am setting up the automated tests for the various features. I am encountering a problem with the testing environment where I can run smoothly each test one by one without failure, I can even run some tests grouped at once but if I group too many of them or try to run all tests the process freezes at some point and crashes with the enigmatic message “[Error] The active test run was aborted. Reason: Test host process crashed” …

  • Any idea on how to solve this ?
  • Could this be related to RhinoDoc.ActiveDoc usage on several tests ? I was also wondering if there is a safe way to clean the ActiveDoc between tests when running multiple tests, since some of them are testing the serialisation of my plugin (through Read/WriteDocument) I kind of need to go with ActiveDoc save/Open right ?

I am using Rhino.Testing package and correctly (hopefully) using RhinoSetupFixture and RhinoTestFixture.

Thanks for your help

I’m having the same problem. Could be any roblem of the antivirus/firewall?

I’m having the same problem on my CI agent so I doubt that it could be related to firewall.

I was able to narrow it down to a simple usecase with 2 tests, if I run each test separately they execute fine but if I try to tell VS or dotnet test to run both of them the process crashes.
Here are the tests :

[Test]
public void MyFirstTest()
{
    // do stuff
    string file = "myoutput.3dm";
    // test save
    Rhino.RhinoDoc.ActiveDoc.SaveAs(file);
    // some tests
    // test reload with mycustomplugin ReadDocument being called (that's what I want to test)
    Rhino.RhinoDoc.Open(file, out bool _);
    // some tests
}

[Test]
public void MySecondTest()
{
    //do stuff and load files using File3dm.Read
    // usually crashes after some files have been read but not all, if I read only file there is no crash ...
}

Update here : this really feels like an out of memory problem, if I load one or 2 files in my second test all goes well but if I load 18 files it crashes …
The weirdest part for me is that if I invert the test order (first test loads 18 files with File3dm.Read and second tests writes and reads RhinoDoc) everything goes well (but it fails for the next tests so I still can’t run my whole test base).

@Joshua_Kennedy do you have any idea about this ?

Hey @thomas.pitiot

  • Are you including Grasshopper in your tests?
  • Can you post your Rhino.Testing.Configs.xml?
  • Do you have any more info in the Tests Output?

I’ve created a ticket to look into this issue.

Hi,

  • No I’m not using Grasshopper so I disabled it in my xml, here it is :
<?xml version="1.0" encoding="utf-8"?>
<Settings>
  <RhinoSystemDirectory>C:\Program Files\Rhino 8\System</RhinoSystemDirectory>
  <LoadRDK>true</LoadRDK>
  <LoadGrasshopper>false</LoadGrasshopper>
  <CreateRhinoView>false</CreateRhinoView>
	<LoadPlugins>
		<Plugin Location="Plug-ins\Commands.rhp"/>
	</LoadPlugins>
</Settings>
  • In test output I only get the “test host process crashed” sadly

I updated Nunit test version and now I get more logging outputs before the crash :

[05/05/2025 10:45:41.894 ] [Error] Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
[05/05/2025 10:45:41.896 ] [Error] Repeat 2 times:
[05/05/2025 10:45:41.897 ] [Error] --------------------------------
[05/05/2025 10:45:41.899 ] [Error]    at UnsafeNativeMethods.CRhinoDoc_Delete(UInt32)
[05/05/2025 10:45:41.902 ] [Error] --------------------------------
[05/05/2025 10:45:41.903 ] [Error]    at Rhino.RhinoDoc.Finalize()

Don’t know if it helps your investigation…

Hello @CallumSykes,

It’s been a while and I still cannot properly test my project. I see that the ticket is still Open on YouTrack :confused:
Any idea when this issue can be looked at on your side ?

Cheers

Sorry @thomas.pitiot I’ve gotten a bit sidetracked working on toolbars and the like.

I’ll try and look into this soon when I’ve got a spare moment. One thing that might be worth trying is using the Rhino.Test template. and seeing if this template once set up makes any difference.

Yes I’m sure you’ve got plenty on your plate ^^
I’ll try to take a look at this on my spare time too, and we keep each other updated, thanks.

1 Like