We use LightningChart Headless mode in a module that produces a PDF report that contains charts.
We wanted to write unit tests to that module (to test general requirements like file name, path etc...)
We have an issue with the test, so to figure out what is the problem I wrote a simple test that reproduces the issue:
Code: Select all
using Arction.Wpf.Charting;
.
.
.
[Test]
public void Test()
{
Thread thread = new Thread(() =>
{
var lcu = new LightningChartUltimate();
lcu.ChartRenderOptions.HeadlessMode = true; // When this line is commented out, the issue is NOT reproduced
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
}
I tried to investigate it, and instead of running the test from Resharper, I ran it from nunit-console command line utility:2019.03.04 11:00:08.956 ERROR NUnit.Engine.NUnitEngineException: Exception encountered unloading AppDomain
NUnit.Engine.NUnitEngineException: Exception encountered unloading AppDomain ---> System.CannotUnloadAppDomainException: Error while unloading appdomain. (Exception from HRESULT: 0x80131015)
at System.AppDomain.Unload(AppDomain domain)
at NUnit.Engine.Services.DomainManager.DomainUnloader.UnloadOnThread()
--- End of inner exception stack trace ---
at NUnit.Engine.Services.DomainManager.DomainUnloader.Unload()
at NUnit.Engine.Runners.TestDomainRunner.UnloadPackage()
at NUnit.Engine.Runners.AbstractTestRunner.Dispose(Boolean disposing)
at NUnit.Engine.Runners.AbstractTestRunner.Dispose()
at NUnit.Engine.Runners.MasterTestRunner.Dispose(Boolean disposing)
at NUnit.Engine.Runners.MasterTestRunner.Dispose()
at JetBrains.ReSharper.UnitTestRunner.nUnit30.BuiltInNUnitRunner.<>c__DisplayClass6_0.<RunTests>b__0()
at JetBrains.ReSharper.UnitTestRunner.nUnit30.BuiltInNUnitRunner.WithExtensiveErrorHandling(IRemoteTaskServer server, Action action)
Code: Select all
"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" --noresult --labels=All Test.dll
I used windbg and catched TaskCanceledException when domain is unloading.Test Run Summary
Overall result: Passed
Test Count: 1, Passed: 1, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
Start time: 2019-03-04 09:07:41Z
End time: 2019-03-04 09:07:53Z
Duration: 0.716 seconds
NUnit.Engine.NUnitEngineUnloadException : Agent Process was terminated successfully after error.
----> NUnit.Engine.NUnitEngineUnloadException : Exception encountered unloading application domain
----> NUnit.Engine.NUnitEngineException : Exception encountered unloading application domain: Error while unloading appdomain. (Exception from HRESULT: 0x80131015)
Application domain name: domain-
Thanks,
Yitzchak