Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

scattergraph crashes/hangs application

Instaniating scatterGrpah in VS2005 C++ hangs the CPU under the debugger, or the app is unresponsive when running without the debugger.  The problem occurs in InitializeComponent on the line:
 
this->xAxis1 = (gcnew NationalInstruments::UI::XAxis());
 
This happened when I added Measurement studio 8.1.2 .NET to my existing C++ project.  When I create a new project, add a windows form, and drag a scatterGraph onto the form, the problem does not occur.  My existing project is very large and I do not want to move all of the code to a new project.
 
Why does simply instatiating a ScatterGraph cause this problem?
0 Kudos
Message 1 of 6
(4,076 Views)
Hi Matt,

I believe you were working with one of our Application Engineers on this issue so I think I have your example project WKLD1 that you sent to them. Suprisingly I was able to build, compile and even run your project without any of the "hanging" behavior you saw. It created a new instance of the graph on your testForm Windows Form and then exited.  This will make troubleshooting even more difficult so the questions I have for you are:

1) Did this behavior just starting happening with Measurement Studio 8.1.2 or did you have some prior versions of Measurement Studio that worked?

2) Now I assume this code is "watered-down" and on your end this same code reproduced the problem? If this is watered-down code, what exactly did you remove from the code? Did you remove any thread-calls under the assumption you are doing multi-threading? The obvious theory is that you are hitting some race condition and its causing a deadlock.  I was hoping that I could reproduce this behavior on my end but unfortunaltey which makes this issue is more difficult to diagnose. If you can provide me with a larger project that I can atleast run and get to the form instantiation part, that would be helpful. 

3) Does the behavior occur with only NI controls or have you tried dropping down native .NET controls like the TreeView control, ListBox control, etc.  What about other NI controls like Leds, Tanks, Gauges, etc?

4) I see in your code, WKLD1.cpp, you are doing several operations before creating an instance of your form like parsing the command linke, creating an MDI frame window. What happens if you comment out all your "user-code" before making a call to the statement WKLD1::testForm^ myTestForm = gcnew WKLD1::testForm;

5) Did insertting the graph control ever work? If so, did you try and diff the non-working version to the working version?

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 2 of 6
(4,073 Views)

Jonathan,

 

Thanks for the reply.  The project you have is not an example project , it is the actual project I have been working on for several months.  It is not watered down either.  What you have is the same code I working on.

 

However, “testForm” is not part of my project. I added it to the beginning of the code to simplify the problem.  All of the code before the statement: WKLD1::testForm^ myTestForm = gcnew WKLD1::testForm; was generated by the project wizard.

 

You are right about solving the issue.  If the code compiles and runs for you, it makes it more difficult to find the problem.  Are you using Visual Studio 2005, Service Pack 1?

 

When I run the project under the debugger, the CPU hangs on the statement: this->xAxis1 = (gcnew NationalInstruments::UI::XAxis()); when testForm is instantiated.  When running without the debugger, the application becomes “Not Responding”.

 

Here are answers to you questions.

 

1)    The problem started when I installed MS 8.1.2 and integrated it into my project.  I did not have a prior version installed. However, Labview 7 was installed.

 

2)    The code is not watered down

 

3)    I have only added NI controls (waveFormGraph and scatterGraph).  Originally I had three waveFormGraphs on the form and they worked correctly.  When I switched  them to scatterGraphs the problem started, and I was unable to revert back to waveFormGraphs.

 

4)    I will try moving the instantiation of myTestForm ahead of the wizard generated code.

 

5)    I will see if I can diff the code.

 

Some other points of interest.

 

I went through the “Walkthrough: Creating a MS Application with Windows Form Controls and Analysis in VS 2005” on page 5-34 in the Users Manual. I did this for familiarization with MS.  This project works correctly. However, at some point an error popped up on its own in the Form Designer.  It stated that the Minimum value is equal to the Maximum value. I cannot get this error to go away. I get the impression that something got corrupted.  So I completely re-installed MS (twice) which made no difference.

 

I created a new, empty, VS .NET project and added a Windows form with scatterGraphs. It compiles and runs fine.

0 Kudos
Message 3 of 6
(4,069 Views)
Hi Matt,

Yes, I do have VS 2005 SP1 installed on my machine as well as my test machine. On both machines I ran your project and everything compiled and ran fine. 

- Do you not have SP1 for Visual Studio 2005 installed?
- Do you have SP1 for the .NET Framework installed?
- Have you tried testing your application on another machine? If so, does it run normally?
- What about adding other non-NI controls? Do you see the same hanging behavior then?
- I know this may take a little time, but have you tried copying an pasting your code into another C++/CLI project to see if that works? This would be under the scenario were your project is somehow in a corrupted state and this would just help validate this theory.  This shouldn't take to long since you just need to copy, paste and add a few files to the new project.

The last error that you mentioned would come from a user editing the
InitializeComponent auto-generated code. When you switch back to the design-view, Visual Studio will try to re-create the controls and if you deleted/added/modified the InitializeComponent method with invalid statments, then I can see you getting into that undefined state. It is not recommended that you edit InitializeComponent.  If you didn't modify InitializeComponent, then  would like to try and reproduce those steps you took to get into that state. 

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 4 of 6
(4,066 Views)

Jonathan,

I think we have a breakthrougjh.  I installed .NET Framework 2.0 SP1 and the project now compiles and runs without hanging.  I am cautiously optimistic, as you know these type of problems can come back from the dead.  I am going to roll back my code to remove the testForm.  Then I will add the frequency domain analysis and ploting that I was originally working on.  If all goes well, I will be a happy man and this matter will be closed. If success prevails, this forum thread should be useful to anyone who encounters the same behavior.

 

Matt

0 Kudos
Message 5 of 6
(4,058 Views)
Hi Matt,

I really not sure why installing SP1 fixed your problem as there were just a few minor updates that SP1 provided our .NET libraries. My only other thought is that maybe some of your user code was dependent upon some .NET features that was upgraded in SP1. 

Glad everything works

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 6 of 6
(4,043 Views)