Assembly not found exception when run UnitTests on TeamCity

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

silviofuchs
Posts: 4
Joined: Wed Jun 14, 2017 11:32 am

Assembly not found exception when run UnitTests on TeamCity

Post by silviofuchs » Fri Jul 14, 2017 1:58 pm

We are using using the semibindable version of LightningChartUltimate (LightningChartUltimateWPF8, v8.1.1.1)
We are running unit tests with NUnit 2.6.3 on TeamCity 2017.1.1. If we instantiate LightningChartUltimate inside a unit test the following Exception appears:

[13:51:02]Step 1/1: Run UnitTests (NUnit) (13s)
[13:51:02][Step 1/1] Starting: "C:\Program Files\TeamCity\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe" #TeamCityImplicit
[13:51:02][Step 1/1] in directory: C:\TcWork\Metrohm.Controls.Chart.Components_ChartControl_UnitTest.trunk
[13:51:04][Step 1/1] Start TeamCity NUnit Test Runner
[13:51:04][Step 1/1] Running NUnit-2.6.3 tests under .NET Framework v4.0 x64
[13:51:05][Step 1/1] Metrohm.Controls.Chart.Test.dll (9s)
[13:51:05][Metrohm.Controls.Chart.Test.dll] Metrohm.Controls.Chart.Test.Tracker.ClassTest.Feature_WhenScenario_ThenBehaviour (9s)
[13:51:05][Metrohm.Controls.Chart.Test.Tracker.ClassTest.Feature_WhenScenario_ThenBehaviour] [Test Error Output]
Log: SetUp ClassTest Feature_WhenScenario_ThenBehaviour
Log: Test ClassTest Feature_WhenScenario_ThenBehaviour
[13:51:07][Metrohm.Controls.Chart.Test.Tracker.ClassTest.Feature_WhenScenario_ThenBehaviour] [Test Error Output]
Unhandled exception in remote appdomain: Arction.Wpf.SemibindableCharting.ChartException: Assembly not found: Render device create failed: Rendering engine initialization failed. None of the requested engines could be loaded. For more information, use GetLastEngineInitResults() method.Stack trace: bei Arction.Wpf.SemibindableCharting.LightningChartUltimate.XVC(ErrorType A, Object C, String F, String H, Boolean I, Exception J)
bei Arction.Wpf.SemibindableCharting.LightningChartUltimate.CWC()
bei Arction.Wpf.SemibindableCharting.LightningChartUltimate.ControlLoadedWPF(Object sender, RoutedEventArgs e)
bei Arction.Wpf.SemibindableCharting.LightningChartUltimate.XVC(ErrorType A, Object C, String F, String H, Boolean I, Exception J)
bei Arction.Wpf.SemibindableCharting.LightningChartUltimate.ControlLoadedWPF(Object sender, RoutedEventArgs e)
bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
bei System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
bei System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
bei MS.Internal.LoadedOrUnloadedOperation.DoWork()
bei System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
bei System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
bei System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
bei System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
bei System.Windows.Interop.HwndTarget.OnResize()
bei System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
bei System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

Have you any idea what goes wrong and which assembly is missing?
We haven't had this problem with LightningChart version 7.1.2 (non bindable version)

Please have a look at the attached code sample containing the unit test.
Attachments
LightningChartSample.zip
LightningChartUnitTestSample
(4.58 KiB) Downloaded 549 times

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: Assembly not found exception when run UnitTests on TeamC

Post by ArctionPasi » Fri Jul 14, 2017 2:21 pm

Hello,

can you please check Arction.DirectXFiles.dll is in place it can find it?
And actually check all DLLs required:
  • • Arction.Wpf.Charting.LightningChartUltimate.dll (if using Non-bindable WPF chart)
    • Arction.Wpf.SemibindableCharting.LightningChartUltimate.dll (if using semi-bindable WPF
    chart)
    • Arction.Wpf.BindableCharting.LightningChartUltimate.dll (if using fully bindable WPF chart)
    • Arction.Licensing.dll
    • Arction.DirectX.dll
    • Arction.RenderingDefinitions.dll
    • Arction.RenderingEngine.dll
    • Arction.RenderingEngine9.dll
    • Arction.RenderingEngine11.dll
    • Arction.DirectXInit.dll
    • Arction.DirectXFiles.dll
LightningChart Support Team, PT

silviofuchs
Posts: 4
Joined: Wed Jun 14, 2017 11:32 am

Re: Assembly not found exception when run UnitTests on TeamC

Post by silviofuchs » Mon Jul 17, 2017 6:59 am

I've verified the assemblies. All listed assemblies are there.

silviofuchs
Posts: 4
Joined: Wed Jun 14, 2017 11:32 am

Re: Assembly not found exception when run UnitTests on TeamC

Post by silviofuchs » Mon Jul 17, 2017 7:39 am

if we are using non bindable version (Arction.Wpf.Charting) it works fine.
the assembly not found exception occurs only on semi and full bindable versions.
we also tried to get more information by calling GetLastEngineInitResults(). Unfortunately it's not possible, because the assembly not found exception occurres in constructor of LightningChartUltimate.
can you get more information from the callstack?

User avatar
ArctionLasse
Posts: 26
Joined: Fri Mar 27, 2015 11:23 am

Re: Assembly not found exception when run UnitTests on TeamC

Post by ArctionLasse » Tue Jul 18, 2017 6:52 am

Hi,

It's a bit hard to determine why the engine initialization is failing from this information, so we'd need to get the GetEngineInitResults(). Unfortunately I can think of no way to get it properly if this happens on construct time, as you can not properly register to any events before the crash. On WPF the engine init happens when the control is loaded, meaning when the control is set on visual tree. Normally that does not happen when the object is constructed, but only when it's set on visual tree, by setting it as child of an other control.
Could you modify your software so that you create the LC in codebehind, and not set it to visual tree. This way the engine init should not happen. Then register to the ChartError event, and when the device init failure comes read the GetEngineInitResults() return value.

If the engine init & crash still happens on constructor time, could you provide us with a memory dump of your application for us to debug.

The reason why the crash happens on bindables and not on nonbindable versions is that the ChartOptions. ThrowChartExceptions property defaults to true, which is wrong and will be fixed in the future. Other versions probably fail on the engine inti as well, but do not throw an exception because of it.
LightningChart Support Team, LV