Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

Getting where the exception is thrown in Windows Error Report for managed application without a dump

A while ago, an internal thread shows how to get where the exception is thrown in Windows Error Report for managed application without a dump. The thread is very insightful. Shared below: Subject: RE: How to investigate Windows Error Report from managed
Posted by junfeng | 0 Comments
Filed under:

Internal Manifest vs External Manifest

Internal manifest is the RT_MANIFEST resource in the executable. External manifest is App.exe.manifest. In Windows XP, Sxs searches external manifest before internal manifest. If an external manifest is found, the internal manifest is ignored. In Windows
Posted by junfeng | 3 Comments
Filed under:

CLR HRESULT

CLR HRESULT’ facility code is 0x13. If an HRESULT error is 0x8013xxxx, it is likely a CLR error. All CLR errors are defined in CorError.h. You can find CorError.h in your Visual Studio install (or Microsoft Platform SDK). C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\CorError.h
Posted by junfeng | 3 Comments

Be careful about exception after resource allocation

The following is a common code pattern Resource resource = GetResource(); DoWork(); return resource; If DoWork() throws exception, the resource will be leaked. We need to guard against this. For example bool success = false ; Resource resource = GetResource();
Posted by junfeng | 6 Comments
Filed under:

Exception Filter

C# does not support exception filter. However, VB and IL support it. To add exception filter to C#, we can build a function in VB or IL, then call it in C#. The example below is one way we may implement the function to support exception filter. It asks
Posted by junfeng | 7 Comments
Filed under:

ThreadPool.BindHandle

I mentioned that we can use ThreadPool.BindHandle to implement asynchronous IO. Here are roughly the steps necessary to make it happen: 1. Create an overlapped file handle SafeFileHandle handle = CreateFile( filename, Win32.GENERIC_READ_ACCESS, Win32.FILE_SHARE_READ
Posted by junfeng | 8 Comments
Filed under:

ThreadPool.UnsafeQueueNativeOverlapped

CLR’s thread pool has two pools of threads. The first pool is used by ThreadPool.QueueUserWorkItem . The second pool is an IoCompletionPort thread pool used by ThreadPool.BindHandle and ThreadPool.UnsafeQueueNativeOverlapped . ThreadPool.BindHandle is
Posted by junfeng | 3 Comments
Filed under:

Conversion between System.String and char *

We can convert a char * to System.String with System.String’s constructor string str = new string((char*)p); And for the reverse: fixed(char *p = str){} Why do we care about conversion between System.String and char *? From this article , this is the
Posted by junfeng | 3 Comments
Filed under:

XXX is not a valid Win32 application

If you have used your Vista SP1-based computer for extended period, you may experience some problems starting large applications, for example, Office 2007 applications. Specifically, you may receive a message “XXX is not a valid Win32 application”. If
Posted by junfeng | 1 Comments
Filed under:

Managed ThreadPool vs Win32 ThreadPool (pre-Vista)

The following is a conversation between me and a CLR dev. The conversation is very informative so I quote it here. From: Sent: To: Subject: RE: ThreadPool.QueueUserWorkItem There might be some confusion here around the meaning of the term "I/O Thread."
Posted by junfeng | 5 Comments
Filed under:

Managed Watson Dump

From .Net Framework 2.0, Dr. Watson is able to generate dump compatible with .Net framework. This means, dumps with heap data generated by Dr. Watson contains information about managed heap so they can be analyzed with sos.dll. Some update to Dr.Watson
Posted by junfeng | 1 Comments
Filed under:

Inspect a 32 bit Process Dump Generated by a 64 bit Debugger

64 bit Windows can run both 32 bit process and 64 bit process. For debugging though, you want to use 32 bit debugger to debug 32 bit process, and 64 bit debugger for 64 bit process. Otherwise it won’t be pretty. Occasionally, I receive a 32 bit process
Posted by junfeng | 2 Comments
Filed under:

Getting a Full Memory Dump for a Process

To diagnose a problem for a remote customer, sometimes the easiest way is to have the customer generate a full memory dump for the process, and share the memory dump. In Vista, task manager can generate a full memory dump from the Processes tab. In Windows
Posted by junfeng | 0 Comments
Filed under:

Event Handles “leak”

On our stress run, we saw our process’ handle count steadily increases until certain point, then it stabilizes. However the number of handles is high. Most of those handles are Event handles. We are concerned about it. So we went off and did some investigation.
Posted by junfeng | 3 Comments
Filed under: ,

Use !htrace to debug handle leak

Windbg Debugger’s !htrace extension is very handy to debug handle leak. The process essentially boils down to the following simple steps: 1. Enable trace 2. Take a snapshot 3. Run scenario 4. Show the diff On step 4, !htrace will show all the extra opened
Posted by junfeng | 3 Comments
Filed under:
More Posts Next page »
 
Page view tracker