<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ClrDump - Create small minidumps of .NET applications</title><link>http://msmvps.com/blogs/debuginfo/archive/2006/02/26/84886.aspx</link><description>New tool on my web site: ClrDump (Beta) ClrDump is an experimental set of tools that allow to produce small minidumps of managed applications. In the past, it was necessary to use full dumps (very large in size) if you needed to perform post-mortem analysis</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: ClrDump - Create small minidumps of .NET applications</title><link>http://msmvps.com/blogs/debuginfo/archive/2006/02/26/84886.aspx#714856</link><pubDate>Tue, 27 Mar 2007 09:13:48 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:714856</guid><dc:creator>Volker</dc:creator><description>&lt;p&gt;Hi Oleg,&lt;/p&gt;
&lt;p&gt;thanks a lot for this very good work. I've blogged a post on how to create and analyze .net unhandled exception using ClrDump.dll (&lt;a rel="nofollow" target="_new" href="http://voneinem-windbg.blogspot.com/2007/03/creating-and-analyzing-minidumps-in-net.html"&gt;http://voneinem-windbg.blogspot.com/2007/03/creating-and-analyzing-minidumps-in-net.html&lt;/a&gt;). In our current product I'm using MiniDumpWriteDump directly and when I analyze with SOS is seems to be ok (I get the stacks but no handle information and so on). Are you doing anything more in ClrDump.dll? Could you just explain the concept?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Volker&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=714856" width="1" height="1"&gt;</description></item><item><title> Create small minidumps of c#.NET applications  - Need full code</title><link>http://msmvps.com/blogs/debuginfo/archive/2006/02/26/84886.aspx#420771</link><pubDate>Thu, 14 Dec 2006 10:43:54 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:420771</guid><dc:creator>saravanan</dc:creator><description>&lt;p&gt;hello everybody&lt;/p&gt;
&lt;p&gt;Now i am creating sample windows application in c#.net2.0 . &amp;nbsp;now i am plan to create dump for all unhandle exception and application exception. &lt;/p&gt;
&lt;p&gt; &amp;nbsp;last 2 week i search in net. i cannot find any solution. &amp;nbsp;i tried adplus but it is dump file size is high.&lt;/p&gt;
&lt;p&gt;now i trying in dbhelp.dll and clrdmp.dll &amp;nbsp;here below i show my code.&lt;/p&gt;
&lt;p&gt; &amp;nbsp;using this i can create &amp;nbsp;dump &amp;nbsp;but using windbg tool &amp;nbsp;i open this dump but does not break in the expection point in development side.it show &lt;/p&gt;
&lt;p&gt;please give me one example how i create minidump in c# windows application for all exception.&lt;/p&gt;
&lt;p&gt;please reply as much as soon&lt;/p&gt;
&lt;p&gt;regards &lt;/p&gt;
&lt;p&gt;v.saravanan&lt;/p&gt;
&lt;p&gt;india &amp;nbsp;&lt;/p&gt;
&lt;p&gt;mailid &amp;nbsp;vsaravanan_mca@hotmail.com&lt;/p&gt;
&lt;p&gt;my source code&lt;/p&gt;
&lt;p&gt;===========&lt;/p&gt;
&lt;p&gt;public partial class Form1 : Form&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[DllImport(&amp;quot;clrdump.dll&amp;quot;, CharSet = CharSet.Unicode, SetLastError = true)]&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;static extern Int32 CreateDump(Int32 ProcessId, string FileName,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Int32 DumpType, Int32 ExcThreadId, IntPtr ExtPtrs);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[DllImport(&amp;quot;clrdump.dll&amp;quot;, CharSet = CharSet.Unicode, SetLastError = true)]&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;static extern Int32 RegisterFilter(string FileName, Int32 DumpType);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public Form1()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AppDomain.CurrentDomain.UnhandledException +=&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; new UnhandledExceptionEventHandler&lt;/p&gt;
&lt;p&gt; &amp;nbsp; (UnhandleExceptionHandler);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;InitializeComponent();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private void button1_Click(object sender, EventArgs e)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // int i = 0, j = 1, k = 0;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// &amp;nbsp;k = j / i;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new InvalidOperationException(&amp;quot;in valid&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private struct MinidumpExceptionInfo&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public int ThreadId;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public IntPtr ExceptionPointers;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public bool ClientPointers;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;static void UnhandleExceptionHandler(object sender,&lt;/p&gt;
&lt;p&gt;UnhandledExceptionEventArgs e)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Process process = Process.GetCurrentProcess();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MinidumpExceptionInfo mei = new MinidumpExceptionInfo();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mei.ThreadId = AppDomain.GetCurrentThreadId();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mei.ExceptionPointers = Marshal.GetExceptionPointers();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mei.ClientPointers = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// &amp;nbsp; &amp;nbsp;MiniDumpWriteDump(process.Handle, process.Id, stream.Handle, 0, ref mei, IntPtr.Zero, IntPtr.Zero);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CreateDump(process.Id, &amp;quot;DumpTest.vshost.dmp&amp;quot;,0,mei.ThreadId,IntPtr.Zero);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// &amp;nbsp;RegisterFilter(&amp;quot;Minidump.dmp&amp;quot;, 0);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=420771" width="1" height="1"&gt;</description></item><item><title>re: ClrDump - Create small minidumps of .NET applications</title><link>http://msmvps.com/blogs/debuginfo/archive/2006/02/26/84886.aspx#86706</link><pubDate>Fri, 17 Mar 2006 16:19:03 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:86706</guid><dc:creator>Darta</dc:creator><description>ok- we decided that we can't really put the clrdump.dll into our project due to us being hesitant to have an external dll in our process with inability to own the code (sorry - team policy)... But your work is tremendeously valuable as I've seen it in the posts as well as here, so I plead for your help.  I am writing .net 2.0 code to use MiniDumpWriteDump() directly.  I've tried everything I could do pull it off - posts from John Robbins, youself, books, msdn - and i get an error when I call MiniDumpWriteDump() - err = 2 -&amp;gt; canot file the file specified.  I noticed that in your CreateDump() call you are not asking for a file handle but rather a file name.  I think you know smth I don't :-)  I have all the .cs files which clearly show how I SetUnhandledExceptionFilter, the filter function executes, I get exception pointers, create file handle, etc etc for MiniDumpWriteDump()- then call MiniDumpWriteDump() and I get this error (always) - I am using Marshal.GetLastWin32Error();  I am pleading for your help and good will...(can be contacted at tvesel@hotmail.com).  Will also try your email with attached files.  THANKS!!!&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=86706" width="1" height="1"&gt;</description></item><item><title>re: ClrDump - Create small minidumps of .NET applications</title><link>http://msmvps.com/blogs/debuginfo/archive/2006/02/26/84886.aspx#86611</link><pubDate>Thu, 16 Mar 2006 19:53:44 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:86611</guid><dc:creator>Oleg Starodumov</dc:creator><description>What was the return value of RegisterFilter? Was it zero or non-zero?&lt;br&gt;&lt;br&gt;Also, it is not possible to call GetLastError right after PInvoke call (it will not give correct results). Instead, you should change the function definition to this:&lt;br&gt;&lt;br&gt;[DllImport(&amp;quot;clrdump.dll&amp;quot;, CharSet = CharSet.Unicode, SetLastError=true)] &lt;br&gt;public static extern int RegisterFilter(string FileName, uint DumpType); &lt;br&gt;&lt;br&gt;and use Marshal.GetLastWin32Error to get the last error code. Something like this:&lt;br&gt;&lt;br&gt;int ret = RegisterFilter(...);&lt;br&gt;if( ret == 0 )&lt;br&gt;{&lt;br&gt;  int error = Marshal.GetLastWin32Error();&lt;br&gt;  ...&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=86611" width="1" height="1"&gt;</description></item><item><title>re: ClrDump - Create small minidumps of .NET applications</title><link>http://msmvps.com/blogs/debuginfo/archive/2006/02/26/84886.aspx#86604</link><pubDate>Thu, 16 Mar 2006 18:42:58 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:86604</guid><dc:creator>Darta</dc:creator><description>OS -&amp;gt; WinXP SP2&lt;br&gt;.NET 2.0 (v2.0.50727)&lt;br&gt;VS 2005&lt;br&gt;&lt;br&gt;I get the error when I call GetLastError() after I call &amp;quot;int ret = RegisterFilter(filePath, MINIDUMP_TYPE.MiniDumpWithDataSegs)&amp;quot;. &lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=86604" width="1" height="1"&gt;</description></item><item><title>re: ClrDump - Create small minidumps of .NET applications</title><link>http://msmvps.com/blogs/debuginfo/archive/2006/02/26/84886.aspx#86557</link><pubDate>Thu, 16 Mar 2006 11:29:33 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:86557</guid><dc:creator>Oleg Starodumov</dc:creator><description>You do not have to call SetUnhandledExceptionFilter. &lt;br&gt;&lt;br&gt;DbgHelp 6.6.3.5 is a beta version, with some known bugs, so I would recommend to use the released version (6.5.x.x) for production. But it should not affect this problem, since RegisterFilter does not use DbgHelp.dll.&lt;br&gt;&lt;br&gt;In order to reproduce the problem with RegisterFilter, I will need a bit more information:&lt;br&gt;- What operating system version, service pack, .NET Runtime versions are used?&lt;br&gt;- What version of Visual Studio is used?&lt;br&gt;- How exactly and when do you get the mentioned error code? &lt;br&gt;- It would be good if you could post a small but compilable sample that reproduces the problem (e.g. a small console app).&lt;br&gt;&lt;br&gt;Thanks, &lt;br&gt;Oleg&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=86557" width="1" height="1"&gt;</description></item><item><title>re: ClrDump - Create small minidumps of .NET applications</title><link>http://msmvps.com/blogs/debuginfo/archive/2006/02/26/84886.aspx#86444</link><pubDate>Wed, 15 Mar 2006 20:46:10 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:86444</guid><dc:creator>Darta</dc:creator><description>I am simply calling &lt;br&gt;&lt;br&gt;int ret = RegisterFilter(filePath, MINIDUMP_TYPE.MiniDumpWithDataSegs) and the error I get is &amp;quot;1004 - Invalid flags.  filePath is a full file path with file name.  What could be wrong...?  I am on dbghelp.dll version 6.6.35 - just came out.&lt;br&gt;&lt;br&gt;I have a .net app.&lt;br&gt;&lt;br&gt;I have:&lt;br&gt;[DllImport(&amp;quot;clrdump.dll&amp;quot;, CharSet = CharSet.Unicode)]&lt;br&gt;public static extern int RegisterFilter(string FileName, uint DumpType);&lt;br&gt;&lt;br&gt;and mini dump type as - per Microsoft:&lt;br&gt;						public const uint MiniDumpNormal = 0x00000000;&lt;br&gt;									public const uint MiniDumpWithDataSegs = 0x00000001;&lt;br&gt;									public const uint MiniDumpWithFullMemory = 0x00000002;&lt;br&gt;									public const uint MiniDumpWithHandleData = 0x00000004;&lt;br&gt;									public const uint MiniDumpFilterMemory = 0x00000008;&lt;br&gt;									public const uint MiniDumpScanMemory = 0x00000010;&lt;br&gt;									public const uint MiniDumpWithUnloadedModules = 0x00000020;&lt;br&gt;									public const uint MiniDumpWithIndirectlyReferencedMemory = 0x00000040;&lt;br&gt;									public const uint MiniDumpFilterModulePaths = 0x00000080;&lt;br&gt;									public const uint MiniDumpWithProcessThreadData = 0x00000100;&lt;br&gt;									public const uint MiniDumpWithPrivateReadWriteMemory = 0x00000200;&lt;br&gt;									public const uint MiniDumpWithoutOptionalData = 0x00000400;&lt;br&gt;									public const uint MiniDumpWithFullMemoryInfo = 0x00000800;&lt;br&gt;									public const uint MiniDumpWithThreadInfo = 0x00001000;&lt;br&gt;									public const uint MiniDumpWithCodeSegs = 0x00002000;&lt;br&gt;&lt;br&gt;Any help is appreciated.  Also do I have to call SetUnhandledExceptionFilter first before calling RegisterFilter- doesn't sounds like it but just checking.&lt;br&gt;&lt;br&gt;thx&lt;br&gt;					&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=86444" width="1" height="1"&gt;</description></item><item><title>re: ClrDump - Create small minidumps of .NET applications</title><link>http://msmvps.com/blogs/debuginfo/archive/2006/02/26/84886.aspx#85713</link><pubDate>Wed, 08 Mar 2006 08:16:41 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:85713</guid><dc:creator>Wooseok Seo</dc:creator><description>Good to see you at msmvps.com&lt;br&gt;&lt;br&gt;:-)&lt;br&gt;&lt;br&gt;You are a very famous mvp in the microsoft newsgroup, aren't you?&lt;br&gt;&lt;br&gt;Your samples are very helpful. I just want to say thank you.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=85713" width="1" height="1"&gt;</description></item></channel></rss>