1

Closed

Exception on Run Performance Test Interactively

description

Hi!
I just installed and started using Alpaca PPCP-54454.
I tried the example for "Run Performance Test Interactively" but when I hit the "Go" button I get the following exception:
 
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
 
************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Must not create TaskMeter while measuring.
at Microsoft.Concurrency.TestTools.UnitTesting.TaskMeter..ctor(String name, Color color)
at Microsoft.Concurrency.TestTools.UnitTesting.TaskMeter..ctor(String name)
at Datev.Framework.ObjectBuilder.Test.BuilderTest.MyTest() in C:\Entwicklungsframework.NET\DFL2010\main\DFL\Microkernel\UnitTests\MicroKernel\ObjectBuilderTest\BuilderTest.cs:line 51
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Microsoft.Concurrency.TestTools.UnitTesting.MCutConsole.PerformanceTestCaseRunner.<>c__DisplayClass1.<Invoke>b__0() in c:\Users\tball\alpaca\ConcurrencyTools\MCUT.Console\PerformanceTestCaseRunner.cs:line 28
at Microsoft.Concurrency.TestTools.TaskoMeter.Stats.button1_Click(Object sender, EventArgs e) in c:\Users\tball\alpaca\ConcurrencyTools\MCUT.Taskometer\Stats.cs:line 441
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
 
 
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)

CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

mcut
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0

CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Alpaca/bin/mcut.exe

System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

Microsoft.Concurrency.UnitTesting.Execution
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0

CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Alpaca/bin/Microsoft.Concurrency.UnitTesting.Execution.DLL

System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

Microsoft.Concurrency.UnitTestingFramework
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Concurrency.UnitTestingFramework/v4.0_1.0.0.0__64f4c0ee9887d059/Microsoft.Concurrency.UnitTestingFramework.dll

System.Xml.Linq
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll

System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

Datev.Framework.ObjectBuilderTest
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0

CodeBase: file:///C:/Entwicklungsframework.NET/DFL2010/main/DFL/Microkernel/UnitTests/MicroKernel/ObjectBuilderTest/bin/Debug/Datev.Framework.ObjectBuilderTest.dll

Microsoft.Concurrency.Taskometer
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0

CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Alpaca/bin/Microsoft.Concurrency.Taskometer.DLL

Scenario.Managed
Assembly Version: 1.0.0.0
Win32 Version: 

CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft%20Alpaca/bin/Scenario.Managed.DLL

System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

 
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
 
For example:
 
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
 
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
 
 
What went wrong?
-Matthias
Closed Feb 15, 2011 at 11:59 PM by tball
You need to create the TaskMeter outside of the test method, as in: TaskMeter serialMeter = new TaskMeter("Serial"); TaskMeter wfNaiveMeter = new TaskMeter("Wavefront (naive)"); TaskMeter wfBlockedMeter = new TaskMeter("Wavefront (blocked)"); [PerformanceTestMethod(WarmupRepetitions = 2, Repetitions = 5)] public void CompareEditDistanceAlgorithms() { ... }Best,-- Tom

comments

tball wrote Jan 31, 2011 at 1:32 AM

Hi Matthias,

What is the name of the example test and which unit is it from?

-- Tom

MatthiasFG wrote Jan 31, 2011 at 7:37 AM

Hi Tom,

I moved my sample to a total new class library named "AlpacaTests" and put the following code in there:

namespace AlpacaTests
{
public class TestClass
{
    [PerformanceTestMethod]
    public void Test()
    {
        TaskMeter tm = new TaskMeter("Builder1");

        tm.Start();

        ILifetimeContainer lifetime = new LifetimeContainer { new MyDisposableClass() };
        lifetime.Dispose();

        tm.End();
    }
 }
}

I still get the following exception:
************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Must not create TaskMeter while measuring.
at Microsoft.Concurrency.TestTools.UnitTesting.TaskMeter..ctor(String name, Color color)
at Microsoft.Concurrency.TestTools.UnitTesting.TaskMeter..ctor(String name)
at AlpacaTests.TestClass.Test() in C:\Entwicklungsframework.NET\DFL2010\main\DFL\Microkernel\QuickStarts\ObjectBuilder\AlpacaTests\TestClass.cs:line 30
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Microsoft.Concurrency.TestTools.UnitTesting.MCutConsole.PerformanceTestCaseRunner.<>c__DisplayClass1.<Invoke>b__0() in M:\Work\MSR\ChessTool\ConcurrencyTools\MCUT.Console\PerformanceTestCaseRunner.cs:line 28
at Microsoft.Concurrency.TestTools.TaskoMeter.Stats.button1_Click(Object sender, EventArgs e) in M:\Work\MSR\ChessTool\ConcurrencyTools\MCUT.Taskometer\Stats.cs:line 444
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Did I miss something?

-Matthias

MatthiasFG wrote Feb 1, 2011 at 10:47 AM

Hi Tom,

I moved my sample to a total new class library named "AlpacaTests" and put the following code in there:

namespace AlpacaTests
{
public class TestClass
{
[PerformanceTestMethod]
public void Test()
{
TaskMeter tm = new TaskMeter("Builder1");

tm.Start();

ILifetimeContainer lifetime = new LifetimeContainer { new MyDisposableClass() };
lifetime.Dispose();

tm.End();
}
}
}

I still get the following exception:
************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Must not create TaskMeter while measuring.
at Microsoft.Concurrency.TestTools.UnitTesting.TaskMeter..ctor(String name, Color color)
at Microsoft.Concurrency.TestTools.UnitTesting.TaskMeter..ctor(String name)
at AlpacaTests.TestClass.Test() in C:\Entwicklungsframework.NET\DFL2010\main\DFL\Microkernel\QuickStarts\ObjectBuilder\AlpacaTests\TestClass.cs:line 30
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Microsoft.Concurrency.TestTools.UnitTesting.MCutConsole.PerformanceTestCaseRunner.<>c__DisplayClass1.<Invoke>b__0() in M:\Work\MSR\ChessTool\ConcurrencyTools\MCUT.Console\PerformanceTestCaseRunner.cs:line 28
at Microsoft.Concurrency.TestTools.TaskoMeter.Stats.button1_Click(Object sender, EventArgs e) in M:\Work\MSR\ChessTool\ConcurrencyTools\MCUT.Taskometer\Stats.cs:line 444
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Did I miss something?

-Matthias

tball wrote Feb 15, 2011 at 11:57 PM

Matthias,

As the exception message says: System.Exception: Must not create TaskMeter while measuring.

Look at Unit 1 code for EditDistance, for example:
    TaskMeter serialMeter = new TaskMeter("Serial");
    TaskMeter wfNaiveMeter = new TaskMeter("Wavefront (naive)");
    TaskMeter wfBlockedMeter = new TaskMeter("Wavefront (blocked)");

    [PerformanceTestMethod(WarmupRepetitions = 2, Repetitions = 5)]
    public void CompareEditDistanceAlgorithms()
    ...
Best,

-- Tom

tball wrote Feb 15, 2011 at 11:58 PM

You need to create the TaskMeter outside of the test method, as in:
    TaskMeter serialMeter = new TaskMeter("Serial");
    TaskMeter wfNaiveMeter = new TaskMeter("Wavefront (naive)");
    TaskMeter wfBlockedMeter = new TaskMeter("Wavefront (blocked)");

    [PerformanceTestMethod(WarmupRepetitions = 2, Repetitions = 5)]
    public void CompareEditDistanceAlgorithms() { ... }
Best,

-- Tom

wrote Feb 15, 2011 at 11:59 PM

wrote Feb 13, 2013 at 10:14 PM

wrote May 16, 2013 at 5:16 AM