Certain Paneling Tools methods fail when called from Rhino.Inside project

Hi there, I’m trying to write a unit test project for something that uses the PanelingToolsDotNet.dll, which gets installed along with Paneling Tools. In order to make the unit test work, I’m using the Rhino.Inside nuget package, and working off of an example unit test project that uses xUnit.

The issue I’m having is that certain method calls in “PanelingTools.Utility” (which is defined in PanelingToolsDotNet.dll) fail when called from within this project. Two of the methods that fail are PanelingTools.Utility.DivideSurfaceByChordLength(...) and PanelingTools.Utility.TrimGrid(...); however, other methods such as PanelingTools.Utility.DivideSurfaceDomainByLength(...) and PanelingTools.Utility.ExtractCenterGrid(...) work.

The error that causes it to crash is an “Access violation” coming from RhinoCore.dll:

And the stack trace shows a chain of calls going from the test project, into PT_SDK.dll (which I assume is a C++ DLL that is linked to by PanelingToolsDotNet.dll), and into RhinoCore.dll:

The interesting part of this is that this only fails when called within this Rhino.Inside project–but it is fine if called from within a Rhino Plugin Command. I’m a bit confused about why this is. Any help would be much appreciated. Maybe you would have an idea of why, @rajaa

I’ve attached the smallest example project that I can make. Along with the two PanelingTools DLLs, it contains one xunit test method that tries to call some of the methods in PanelingToolsDotNet.dll. The first one it calls is fine, but the second one fails:
PanelingToolsTest.zip (345.4 KB)

Note, the PanelingTools DLLs included in the project are from PanelingTools version 2021.3.2.446 (which is the newest version as of posting this)