when profiling apps with CLR Profiler v2.0 (from MSDN sample), always throw exception
-
2007年12月6日 13:42
i try to use CLR Profiler v2.0 sample from MSDN to profiling managed windows form apps , always throw exception.
exception text is:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.************** Exception Text **************
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at WindowsApplication1.Form1.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()The profiler sample is from "No Code Can Hide from the Profiling API in the .NET Framework 2.0". I build the dll, then use command line to regsvr.
thanks!
全部回复
-
2007年12月7日 1:46所有者:
Hello! I went to http://msdn.microsoft.com/msdnmag/issues/05/01/CLRProfiler and downloaded the profiler to try this out (please verify that's the same profiler you used). I then went to a command-prompt and did the following:
regsvr32 Profiler.dll
set COR_PROFILER={18884ADE-B15B-4af8-BE6C-FE5117BA4B32}
set COR_ENABLE_PROFILING=1
I then picked the first Windows Forms app I saw, which happened to be the profiler's Launcher.exe. So I just ran Launcher.exe from the command-prompt. So I was actually using the profiler to profile its own Launcher.exe tool, which is a little weird I know, but it was the first Windows Forms app I could find. (I didn't actually enter anything into the Launcher.exe UI, I just let it render its form and watched as the profiler did its logging). I verified that Profiler.dll got loaded as Launcher.exe executed and rendered its forms. But I never saw any exceptions. I wonder if I need to be running the particular Windows Forms app you were running? If you could give me more specifics about your scenario, I'll have a better chance of reproducing it here.
Thanks!
Dave
-
2007年12月7日 15:07
Thanks Dave
I just unpack the CLR Profiler.rar, there is a compiled dll in debug folder. I use it in command prompt to profile a win forms app, no modification to the code. Then exception.
Then I compile the profiler to release version, (project file is converted from vs8 to vs9), still exception.
But i find the key maybe:
m_dwEventMask |= COR_PRF_MONITOR_ENTERLEAVE;
dwFooMask += COR_PRF_MONITOR_ENTERLEAVE;When I delete EnterLeave mask, there's no exception. Maybe the reason is inline asm code for ENTERLEAVE function?
-
2007年12月10日 19:09所有者:
I verified that I'm executing through FunctionEnterNaked2 without problems. My guess is we may be executing different versions of the runtime. If you'd like to probe deeper, here are a couple things you can do to help:
1) Get a full stack trace at the point of the exception, including all unmanaged code. You'll want to ensure your debugger is connecting to the Microsoft symbol server to ensure you're getting all the symbols for the runtime: http://msdl.microsoft.com/download/symbols.
2) Verify which versions of mscorwks.dll / mscordbc.dll are getting loaded. Using a debugger, detect the full path of the versions of those DLLs getting loaded, and check their version info in Windows Explorer.
Thanks for your help!
-
2008年3月22日 19:31I have the exact same problem.
I went to the MSDN article on using the CLR profiler to profile the heap, and downloaded the exe zip file from the link in that article.
Then I ran the EXE to un-zip into the default location c:\clr profiler
Then I ran the profiler, and pointed it at my application, which is an XNA Framework v2 application.
The profiler starts the application, but the dialog saying "waiting for the application to start common language runtime" doesn't go away -- it doesn't appear to see that the application is starting.
When I quit my application I get the same exception from the profiler.
I am running Windows XP SP2, and I have both Visual Studio 2005 SP1 and Visual Studio 2008 installed, as well as XNA Game Studio 2 for Visual Studio Pro.
[code]See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at CLRProfiler.Form1.checkProcessTimer_Tick(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
CLRProfiler
Assembly Version: 1.0.1395.16737
Win32 Version: 1.0.1395.16737
CodeBase: file:///C:/CLR%20Profiler/Binaries/CLRProfiler.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
[/code] -
2008年3月22日 19:39I solved it. The download pointed at by that article is a 9 MB download called "CLR Profiler.exe," and has this problem.
If you search for "CLR profiler 2.0" and download the link for that particular product, you get a 5 MB download called "CLRProfiler.exe" (note the lack of a space), which works. -
2008年4月24日 15:15
Hi!
I was also receiving the CLR Profiler dialog "Waiting for the application to start common language runtime" and it would throw an exception every time in Windows Vista. Fixed it like this:
1. Make sure that you have the correct version of CLR Profiler (i.e. 2.x for .NET Framework 2.0).
2. CLR Profiler must be started with elevated (administrator) privileges (right click, Run as administrator).
The "Waiting for the application..." dialog box should close immediately when starting your app (I don't even see it now).- 已建议为答案 HydPhani 2011年10月8日 0:19
-
2011年10月8日 0:22
Hi
I have downloaded CLRProfiler2.0 - as I understand this works only for .Net Framework 2.0.
Though I have VS 2010 - console application to profile, I set target framework as 2.0 in Project Properties -->Application-->Target framework 2.0 and build
Another important point, run CLRProfile.exe as Administrator ( I have Vista ) , started working!!
thanks
HydPhani- 已编辑 HydPhani 2011年10月8日 0:23 better capsing
-
2012年2月23日 21:58
Hi,
I'm running an app targetting .NET Framework 3.5 SP1, on a 64 bit machine. I've tried both CLR Profiler 2.0 and CLR Profiler 4.0; in both cases I ran the x64 version of CLR Profiler, with Administrative Priviledges. Yet I still get the "Waiting for the application..." dialog box.
My application has clearly started and I'm interacting with it, so the CLR should certainly be being targeted. Any suggestions so I can profile my application?
Thanks!
Orion
I finally got this to work by running the 32-bit version of CLR Profiler. The version you run appears to depend on the bit-version of Windows the application is compiled for, not the machine on which you're running.
- 已编辑 OrionCarrier 2012年2月23日 22:02 Solved:
- 已建议为答案 OrionCarrier 2012年2月23日 22:03
- 已标记为答案 David BromanMicrosoft Employee, Owner 2012年3月5日 22:09

