Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

type load exception - MS 2013

This is a known issue...

 

"A System.TypeLoadException is thrown when the WPF Graph control's DataSource property is assigned an unknown type.
The set of types supported by the Graph control is extensible. When a data type is encountered for the first time, the Graph control performs a search to determine the best descriptor to use. To determine if the type can be supported, the Graph control constructs the type, but this may generate a System.TypeLoadException. The exception is handled by the control and is does not reach the user code. The type search result is cached so that an exception is not thrown each time.

Workaround: Disable the System.TypeLoadExpection Thrown option in the Visual Studio Exceptions dialog."

Note the workaround. How do I disable this specific exception? In the Debug->Exceptions dialog, this exception is not checked (meaning the

app shouldnt break).

 

 

Any idea how soon a service pack will be released?

I've been looking forward to using measurement Studio with WPF.

Disappointing so far.

 

 

0 Kudos
Message 1 of 10
(6,994 Views)

The workaround is referring to the Exceptions dialog, reached via the Debug » Exceptions... menu in Visual Studio:


Visual Studio Exceptions dialog


When the Thrown box is unchecked, the debugger will not pause execution when that exception is encountered and handled. (When the box is checked, the debugger will pause, but you can use F5 to continue execution as normal and allow the exception to be handled.)




Regarding a service pack, I do not have information on the timing of the next Measurement Studio release, but I do know this issue is targeted for a fix in the next version.

~ Paul H
0 Kudos
Message 2 of 10
(6,982 Views)

Thanks for the reply.

 

The thrown box is unchecked but it still pauses.

 

At this point it doesn't really matter. I can't do this in production code.

I'll stick with Winforms until the service pack/next release is available.

0 Kudos
Message 3 of 10
(6,973 Views)

Are you certain you are encountering the same issue described above? If the debugger is still pausing when the box is unchecked, then it may be a new issue raising an unhandled exception in a different part of the code.


Would you mind posting a code snippet so that I can try to reproduce the issue?

~ Paul H
0 Kudos
Message 4 of 10
(6,963 Views)

Yes, I'm sure.

The samples that shipped Measurement Studio throw the same error.

(Samples\DotNet\WPF\Standard\XYPlotting)

 

This is a function from the NI samples.

        public void OnPlotCircleButtonClick(object sender, RoutedEventArgs e)
        {
            const int numberOfPoints = 100;
            const int radius = 10;
            const double angleIncrementFactor = TwoPi / (numberOfPoints - 1);

            double[] dataX = new double[numberOfPoints];
            double[] dataY = new double[numberOfPoints];
            Point[] dataXY = new Point[numberOfPoints];

            double angle = 0;
            for (int i = 0; i < numberOfPoints; ++i)
            {
                angle += angleIncrementFactor;
                dataX[i] = radius * Math.Cos(angle);
                dataY[i] = radius * Math.Sin(angle);
                dataXY[i] = new Point(dataX[i], dataY[i]);
            }

            xGraph.DataSource = dataX;
            yGraph.DataSource = dataY;
            xyGraph.DataSource = dataXY; // Exception thrown here (assigning array of Points as datasource.
        }

 

 

 

0 Kudos
Message 5 of 10
(6,959 Views)

Running the XYPlotting example in Visual Studio 2012, it does look like this matches the known issue (though it occurred in InitializeGraph when I ran the example). After continuing execution, all of the graphs work as expected for the various "Plot ___" buttons; no further exceptions are raised.


Previously you mentioned that you "can't do this in production code". Since the one-time exception described in the known issue is only visible during interactive debugging and does not effect normal execution, I am not sure what "this" you are referring to. Is there another issue, or is it just the debugging inconvenience that is the problem?

~ Paul H
0 Kudos
Message 6 of 10
(6,953 Views)

Actually I didn't run it ourside of the debugger. If it doesn't occur then its a nonissue.

0 Kudos
Message 7 of 10
(6,932 Views)

Yes, the exception is raised, but it is handled before it ever reaches user-level code. The only reason you see it in Visual Studio is because the debugger pauses immediately, before any handling code is run. Outside of the debugger, the issue is not visible.

~ Paul H
Message 8 of 10
(6,927 Views)

Its funny... I installed it on a second PC and the exception isnt raised at all.

I wonder what the difference between the two is.

0 Kudos
Message 9 of 10
(6,924 Views)

Just wanted to let you know this issue was fixed in the Measurement Studio 2015 release.

~ Paul H
0 Kudos
Message 10 of 10
(5,504 Views)