I suddenly started getting the below exception with mbUnit today and I after a couple hours found out how to get rid of it. It
appears The problem is related to how the
Process class works in v1.1 of .NET. Apparently the Process class has a dependency on performance counters, and some how they mysteriously got disabled on my machine causing the process class to throw exceptions, and mbUnit to fail :S
I resolved the problem by setting The "Disable Performance Counters" value to 0 under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance key in the registry. The .reg file you can create and double click on to fix this problem looks like this:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance]
"Disable Performance Counters"=dword:00000000
Below is the full exception and some info I found in the debugger that actually led me to the solution. What a mess. I strongly encourage the mbUnit author to recover from such an exception or at least point out some assistance this was a nasty problem to deal with.
Command: C:\Program Files\mbUnit\mbunit.cons
Command Args: C:\Projects\blah\Source\target\blah.blah.Data.dll
Working Directory:
Assemblies: blah.blah.Data
Coverage File: C:\Projects\blah\Source\target\ncoverreport.blah.data.xml
Coverage Log:
******************* Program Output *******************
MbUnit 2.19.1666.22428 Console Application
Author: Jonathan de Halleux
Get the latest at http://mbunit.tigris.org
------------------------------------------
/report-folder: short form /rf Target output folder for
the reports
/report-name-format: short form /rnf Format string for the re
port name. {0} is replaced by the date, {1} by the time.Default = mbunit-{0}{1}
/report-type:{Xml|Html|Text|Dox} short form /rt Report types supported:
Xml, Html, Text
/show-reports[+|-] short form /sr Show generated reports i
n a window
/filter-category: short form /fc Name of the filtered cat
egory
/filter-author: short form /fa Name of the filtered aut
hor name
/filter-type: short form /ft Name of the filtered typ
e
/filter-namespace: short form /fn Name of the filtered nam
espace
/verbose[+|-] short form /v Return a lot of informat
ion or not...
@ Read response file for more options
------------------------------------------
Parsed arguments:
-- Parsed Arguments
Files:
C:\Projects\blah\Source\target\blah.blah.Data.dll
Report folder:
Report Name Format: mbunit-{0}{1}
Report types:
Show reports: False
Filter Category:
Filter Author:
Filter Namespace:
Filter Type:
Verbose: False
[loading] Assembly C:\Projects\blah\Source\target\blah.blah.Data.d
ll
System.Exception: Problem while loading assembly ---> MbUnit.Core.Exceptions.Rep
ortExceptionException: Error in the application.
Server stack trace:
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
at MbUnit.Core.Remoting.RemoteTestTree.Populate()
at MbUnit.Core.Remoting.TestDomain.Load()
--- End of inner exception stack trace ---
at MbUnit.Core.Remoting.TestDomain.Load()
at MbUnit.Core.Cons.MainClass.RunAssembly(ReportResult result, String aName)
[info] MbUnit execution finished in 0.160682533462706s.
***************** End Program Output *****************
IN DEBUGGER:
A first chance exception of type 'System.InvalidOperationException' occurred in system.dll
Additional information: Process performance counter is disabled, so the requested operation cannot be performed.
CALLSTACK:
> system.dll!System.Diagnostics.NtProcessManager.GetProcessInfos(System.Diagnostics.PerformanceCounterLib library = {System.Diagnostics.PerformanceCounterLib}) + 0x1c9 bytes
system.dll!System.Diagnostics.NtProcessManager.GetProcessInfos(string machineName = ".", bool isRemoteMachine = false) + 0xb8 bytes
system.dll!System.Diagnostics.ProcessManager.GetProcessInfos(string machineName = ".") + 0x34 bytes
system.dll!System.Diagnostics.Process.EnsureState(System.Diagnostics.Process.State state = HaveNtProcessInfo) + 0x21f bytes
system.dll!System.Diagnostics.Process.get_WorkingSet() + 0x14 bytes
mbunit.core.dll!MbUnit.Core.Monitoring.MemoryStatus.MemoryStatus(System.Diagnostics.Process p = {System.Diagnostics.Process}) + 0x47 bytes
mbunit.core.dll!MbUnit.Core.Monitoring.MemoryMonitor.Start() + 0x2c bytes
mbunit.core.dll!MbUnit.Core.RunPipeStarter.Run() + 0x15f bytes
mbunit.core.dll!MbUnit.Core.Remoting.RemoteTestTree.RunPipes(MbUnit.Core.Remoting.TestTreeNode node = {MbUnit.Core.Remoting.TestTreeNode}) + 0x5c bytes
mbunit.core.dll!MbUnit.Core.Remoting.RemoteTestTree.RunPipes(MbUnit.Core.Remoting.TestTreeNode node = {MbUnit.Core.Remoting.TestTreeNode}) + 0x93 bytes
mbunit.core.dll!MbUnit.Core.Remoting.RemoteTestTree.RunPipes(MbUnit.Core.Remoting.UnitTreeNode node = {System.Runtime.Remoting.Proxies.__TransparentProxy}) + 0xda bytes
mscorlib.dll!System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage msg, int methodPtr, bool fExecuteInContext) + 0x30b bytes
mscorlib.dll!System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage msg) + 0x9 bytes
mscorlib.dll!System.Runtime.Remoting.Messaging.ServerObjectTerminatorSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg) + 0x12c bytes
mscorlib.dll!System.Runtime.Remoting.Messaging.ServerContextTerminatorSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg) + 0x1b3 bytes
mscorlib.dll!System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg) + 0x209 bytes
mscorlib.dll!System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(System.Runtime.Remoting.Messaging.IMessage msg) + 0xe6 bytes
mscorlib.dll!System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(byte[] reqStmBuff, System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage smuggledMcm, System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage smuggledMrm) + 0x70 bytes
mscorlib.dll!System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatch(byte[] reqStmBuff, System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage smuggledMcm, System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage smuggledMrm) + 0x6e bytes
mscorlib.dll!System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg) + 0x1e1 bytes
mscorlib.dll!System.Runtime.Remoting.Proxies.RemotingProxy.CallProcessMessage(System.Runtime.Remoting.Messaging.IMessageSink ms, System.Runtime.Remoting.Messaging.IMessage reqMsg, System.Runtime.Remoting.Contexts.ArrayWithSize proxySinks, System.Threading.Thread currentThread, System.Runtime.Remoting.Contexts.Context currentContext, bool bSkippingContextChain) + 0x62 bytes
mscorlib.dll!System.Runtime.Remoting.Proxies.RemotingProxy.InternalInvoke(System.Runtime.Remoting.Messaging.IMethodCallMessage reqMcmMsg, bool useDispatchMessage, int callType) + 0x28d bytes
mscorlib.dll!System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(System.Runtime.Remoting.Messaging.IMessage reqMsg) + 0x113 bytes
mscorlib.dll!System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData msgData, int type) + 0x288 bytes
mbunit.core.dll!MbUnit.Core.Remoting.TestDomainCollection.RunPipes(MbUnit.Core.Remoting.UnitTreeNode node = {MbUnit.Core.Remoting.UnitTreeNode}) + 0xad bytes
mbunit.forms.dll!MbUnit.Forms.ReflectorTreeView.RunTests() + 0x106 bytes
posted @ Tuesday, July 27, 2004 1:44 PM