NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Message Popup steptype crashes API in TestStand 2021 when using an image

Hello everyone,

 

We are using the TestStand API to build a shell for the TestStand API, using the NationalInstruments.TestStand.Utility.dll and such.

It came to our attention that NI has changed the Message Popup steptype in the 2021 sp version, as it uses the CEFBrowserSubProcess instead of what was used before (in 5.0, 19 and 20).

 

When executing the following sequence:

Just some actions that doesn't do anything and a message popup which contains a picture and 2 buttonsJust some actions that doesn't do anything and a message popup which contains a picture and 2 buttons

(which are just some actions that doesn't do anything and a message popup with 2 buttons and one image)

Will firstly create five CefBrowser processes:

jopexa_1-1696600171308.png

(which seems hardcore for just on popup window with a picture in it)

and then just crash the program.

The event viewer shows the following, only when running the program from visual studio:

 

Error occured in the module: reportview.dll_unloaded, version 21.1.0.49154
Error code: 0xc000041d
[error something]: 0x00058cb0
Process-ID: 0x4bdc
Path to module: reportview.dll

(Translated this from my language, so take it with a little bit of salt if it isn't completely correct.)

 

I checked up both the CefBrowser process and the error code 0xc000041d, which seems to point me towards some webb browser error, chromium to be exact.

When running a identical version of the sequencefile in the 2020 version I just get one extra process:

jopexa_2-1696600900807.png

which doesn't use the CefBrowser API, and everything works ok.

If I run that sequence, unedited in the 2021 TS version, it will crash like usual.

I can run the the sequence in TestStand, with it not crashing, but not in our own developed program.

I have looked through documentation in the doc folders, on NI:s website and on the forums, but I have not found anything which talks about either the change or this problem.

 

We are using .net 4.5.2 for the project if that might be the problem, as I haven't found anything which explains what it might be.

 

Some weird stuff that sometimes happens:

The whole program process disapears from the process manager, but it still runs and works.

Sometimes it doesn't crash on the first run.

Sometimes it crashes when the sequence is done.

0 Kudos
Message 1 of 7
(1,964 Views)

Sorry, wrote this in a hurry a noticied that I forgot the question itself, which is if anyone has a clue to what might be wrong.

 

Things I have tested since last I posted:

 

Changing the NationalInstruments.TestStand.Utility.dll to the 2021 version (as we have the 2012 version because we it), which didn't change anything.

Removed the CEFBrowserSubProcess.exe in hope that it might trigger some back compability stuff, just crashed everything.

Replaced the reportview.dll with the one from 2020, in hope that it might just point to the old system, created just an error.

Tested the solution which was posted on Steam forum for a game, which seemed to have the same problem (https://steamcommunity com/app/107410/discussions/1/350542683208096939/?l=hungarian)  by setting the compability mode on both our program and the CEFBrowserSubProcess to be for Windows 7, didn't change anything.

 

Should also be noted that it seems like the message popup does not crash the program if there is no picture in it. It does not create 5 CEFBrowserSubProcess either where there is only text and buttons in it.

jopexa_0-1696609164003.png

 

0 Kudos
Message 2 of 7
(1,921 Views)

Johan, 

I have not worked with TestStand in quite some time, but here are the questions that I think might direct you to next steps and help from others:

1) Can you be more specific on what versions of TestStand where this worked successfully?

2) I am unclear as to whether the crash occurs in the TestStand 2021 Sequence Editor, or any of the default example operator interfaces included with TestStand?

3) If TestStand default applications crash, then this is likely a TestStand issue and you would likely have to share the image so that NI can reproduce the issue and debug.

4) If TestStand default applications do not crash then it is likely related to your operator interface.

5) If related operator interface, can you compile your operator interface with .NET 4.6.2 to see if that prevents the issue? Knowing this will likely tell you a lot.

6) Unclear if you are seeing this with a specific image or set of images, or any image. If this is for a specific set of images, my suggested next debugging step would be to determine if there is something specific about the image that is causing the issue. Not sure of the image size, format and color depth, but you could try varying the size and depth, and even the file format as a test to see if the specific file/format is causing the crash. 

Scott Richardson
https://testeract.com
Message 3 of 7
(1,884 Views)

Johan,

You are correct that in TestStand 2021 SP1 the message popup has been modified to use a Chromium Embedded Framework (CEF) based web browser to show images and web pages.  The change caused the issue you are seeing.  The issue has been fixed and will be included in the next release of TestStand.

 

Without going into too much detail, the issue is due to how the Chromium-based browser is initialized and shutdown.  Since I can see that you are using your own UI, one workaround you can do to prevent the crash is to load a reference to ReportView.dll in your UI. ReportView.dll is in the TestStand bin folder.  If you load the dll before you show a message popup with an image, you should not see the crash.  Make sure you unload the dll when your UI shuts down.  

 

If you look at the message popup step source, you will notice that it uses an instance of the ReportView UI control to display web pages and images.  The Report UI control uses a Chromium-based browser and this is the reason adding and keeping a reference to ReportView.dll fixes the issue.

 

Let us know if the workaround fixes the issue.

 

Jose Hernandez

National Instruments

Message 4 of 7
(1,864 Views)

Hi Scott,

Thanks for taking your time with my question.

 

1) When having TS 2012 SP1 (5.0.1), 2019 (19.0) or 2020 (20.0) activated, the steptype Message Popup will not crash. Only in version 2021 SP1 (21.1) will this happen. Does not matter if it is a 5.0.1, 19.0, 20.0 or 21.1 version of the sequence file. This is as long as you include a picture in it.

2) The crash does not happen in Teststands sequence editor. I do not know about the rest of NI's products, as I do not use them.

4) Would make sense, but the software does not destinct 21.1 version from the other ones, except for the 2012 version, as no mayor changes has been made since the 20.0 version to justify such a thing. This means the possibility of changes in your API is the main suspect right now.

5) I tried to compile it in 4.6.2, but this didn't make any change.

6) I have tried with various pictures with different file types, resolutions and such before asking the question, and they all makes it crash.

 

Kind regards,

Johan

0 Kudos
Message 5 of 7
(1,808 Views)

Hello Jose,

Thank you for taking time with my question.

I tried to load it in into the references, but get the following error when doing so:

jopexa_0-1696856390698.png

I tried to add the NI-Reports:

jopexa_2-1696856480730.png

But this didn't change anything either.

I also tried

[DllImport("reportview.dll")]

But, it didn't help either.

 

I went through this thread, and all of its solutions:

https://social.msdn.microsoft.com/Forums/en-US/c194f361-afcb-47ac-81e9-8be60cbc25a0/a-reference-to-t...

But none of them seems to be working either, as they are probably more suited for earlier versions of VS.

 

You wrote 'The issue has been fixed and will be included in the next release of TestStand'. Does that mean the version after 2022 Q4? Just so I know which one.

 

Also, is there anywhere you post these kind of changes? I couldn't find you using chromium in any of the help files in doc, or anywhere on your website. I think it would be great to find these changes somewhere so developers can test these changes to see if everything works as it is expected to do before realeasing anything. I unserstand thou that you probably don't do these kind of changes often.

 

Kind regards,

Johan.

0 Kudos
Message 6 of 7
(1,805 Views)

Hi Johan,

The fix will be in TestStand 2023 Q4.

 

The online help for TestStand 2021 SP1 New Features mentions we have removed the dependency on Microsoft Internet Explorer (IE) which is what the Message Popup have used to show images.  Since we have removed the dependency to IE, we have updated the Message Popup to not use IE and instead use the new chromium-based browser.  The online help does not call out chromium-based browser since that is an internal detail implementation of the new browser.

 

After seeing the errors you are getting, I have realized you are loading ReportView.dll in a .NET app.  The error you are seeing is most likely due to not finding the dependencies.  To find the dependencies, you will need to change the current working directory to the location of ReportView.dll.  To do this, you can do something like this

 

private void LoadReportViewDll()
{
   string savedCurrentDirectory = Directory.GetCurrentDirectory();
   Directory.SetCurrentDirectory(<TestStand Bin Folder>);

   IntPtr reportViewDllHandle = LibraryNativeMethods.LoadLibrary("ReportView.dll");
   System.Diagnostics.Debug.Assert(reportViewDllHandle != IntPtr.Zero);

   Directory.SetCurrentDirectory(savedCurrentDirectory);
}

public static class LibraryNativeMethods
{
   [DllImport("kernel32.dll", SetLastError = true)]
   public static extern IntPtr LoadLibrary(string dllToLoad);
}

 

This post explains how the dependencies are searched.
 
Regards,
Jose
Message 7 of 7
(1,780 Views)