Junfeng Zhang's Musing

things about the world, world of things

When access a symbolic link on a file server, sometimes you may see the following error: "The...

Author: Junfeng Zhang Date: 05/07/2012

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...

Author: Junfeng Zhang Date: 07/27/2009

Internal Manifest vs External Manifest

Internal manifest is the RT_MANIFEST resource in the executable. External manifest is...

Author: Junfeng Zhang Date: 05/11/2009

CLR HRESULT

CLR HRESULT’ facility code is 0x13. If an HRESULT error is 0x8013xxxx, it is likely a CLR error. All...

Author: Junfeng Zhang Date: 03/02/2009

Be careful about exception after resource allocation

The following is a common code pattern Resource resource = GetResource(); DoWork(); return resource;...

Author: Junfeng Zhang Date: 02/02/2009

Exception Filter

C# does not support exception filter. However, VB and IL support it. To add exception filter to C#,...

Author: Junfeng Zhang Date: 12/08/2008

ThreadPool.BindHandle

I mentioned that we can use ThreadPool.BindHandle to implement asynchronous IO. Here are roughly the...

Author: Junfeng Zhang Date: 12/01/2008

ThreadPool.UnsafeQueueNativeOverlapped

CLR’s thread pool has two pools of threads. The first pool is used by ThreadPool.QueueUserWorkItem....

Author: Junfeng Zhang Date: 11/24/2008

Conversion between System.String and char *

We can convert a char * to System.String with System.String’s constructor string str = new...

Author: Junfeng Zhang Date: 08/11/2008

XXX is not a valid Win32 application

If you have used your Vista SP1-based computer for extended period, you may experience some problems...

Author: Junfeng Zhang Date: 08/04/2008

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...

Author: Junfeng Zhang Date: 07/21/2008

Managed Watson Dump

From .Net Framework 2.0, Dr. Watson is able to generate dump compatible with .Net framework. This...

Author: Junfeng Zhang Date: 07/14/2008

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...

Author: Junfeng Zhang Date: 06/30/2008

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...

Author: Junfeng Zhang Date: 06/19/2008

Event Handles “leak”

On our stress run, we saw our process’ handle count steadily increases until certain point, then it...

Author: Junfeng Zhang Date: 04/28/2008

Use !htrace to debug handle leak

Windbg Debugger’s !htrace extension is very handy to debug handle leak. The process essentially...

Author: Junfeng Zhang Date: 04/21/2008

Consider Creating a new class for locking

C# provides keyword lock for synchronized access. A good practice is to create a private object for...

Author: Junfeng Zhang Date: 04/14/2008

A case study of a NullReferenceException

We are seeing a NullReferenceException in our stress program. The investigation process may be...

Author: Junfeng Zhang Date: 04/07/2008

App Config’s root element should be namespace-less

The root element for Application config file is <configuration> <?xml...

Author: Junfeng Zhang Date: 03/24/2008

Getting the right exception context from a memory dump

When debug a memory dump, the dump may not in the right exception context when it is first loaded in...

Author: Junfeng Zhang Date: 03/03/2008

Calculating the size of each GC generation

Sos.dll does not have a command to tell the size of each GC generation. However, you can calculate...

Author: Junfeng Zhang Date: 02/25/2008

Figuring out object allocation graph from a managed memory dump

when debugging a managed memory dump, we can use Sos.dll to inspect managed objects inside the dump....

Author: Junfeng Zhang Date: 02/21/2008

Windows Update Error 0x800A0030

The other day my Windows XP machine suddenly can not use Windows Update. Internet Explorer went to...

Author: Junfeng Zhang Date: 02/18/2008

Windows Performance Tools Kit

Windows Performance Team has released Windows Performance Tools Kit to the Windows SDK for Windows...

Author: Junfeng Zhang Date: 02/11/2008

Reverse P/Invoke and exception

P/Invoke is managed code executing a native function pointer. And Reverse P/Invoke is native code...

Author: Junfeng Zhang Date: 01/28/2008

From Unhandled Exception to Debugger Attach

I was always wondering what is happening between an application throws an unhandled exception, and a...

Author: Junfeng Zhang Date: 11/19/2007

Assembly Loading and Authorization

CLR does not do anything special regarding authorization during assembly loading. It will try to...

Author: Junfeng Zhang Date: 11/12/2007

Mismatched PDBs --- Why?

If you are developing software, most likely you have encountered the "mismatched pdbs" debugger...

Author: Junfeng Zhang Date: 11/05/2007

Windows Vista Sxs Activation Context Cache

Sxs activation model is built on top of Actication Context. To create an activation context, use the...

Author: Junfeng Zhang Date: 10/01/2007

Configuring IIS to Run 32-bit or 64 bit Applications on 64-bit Windows (IIS 6.0)

I was trying VMWare Server on a 64 bit Windows Server 2003 machine to see if I can use it to create...

Author: Junfeng Zhang Date: 09/03/2007

MiniDumpAuxiliaryDlls and KnownManagedDebuggingDlls

I accidentally stumble on these two registry keys. And the expert in Windows Debugger team answers...

Author: Junfeng Zhang Date: 08/20/2007

Loading CLR DAC dll from a different path

From .Net framework 2.0, CLR creates a debugger helper dll mscordacwks.dll. The dll is used by...

Author: Junfeng Zhang Date: 08/13/2007

The Unusual Ref/Def Mismatch FileLoadException

One of my colleagues has experienced a very strange Ref/Def Mismatch FileLoadException (The located...

Author: Junfeng Zhang Date: 08/06/2007

The sequence of interactions between CLR loader and fusion during Assembly.Load

The following describes roughly the sequence of interactions between CLR loader and fusion during...

Author: Junfeng Zhang Date: 08/06/2007

advantages and disadvantages of delay load (LoadLibrary)

Some knowledgeable people posted the following wisdom about delay load. Archived here to share. The...

Author: Junfeng Zhang Date: 08/01/2007

Lock(object) and ThreadAbortException

We have experience some weird deadlock using managed code. We have a class with some shared...

Author: Junfeng Zhang Date: 07/30/2007

Don't catch all exceptions

One of the best practices on exception is don't catch all exceptions. There are many reasons why...

Author: Junfeng Zhang Date: 07/25/2007

Finding Memory leaks

MSDN and Microsoft support web site have some great information on how to find memory leaks, both...

Author: Junfeng Zhang Date: 07/23/2007

Questions and Suggestions -- July 20th Edition

This is the re-occuring post for questions and suggestions. I will not be able to provide any...

Author: Junfeng Zhang Date: 07/20/2007

64 bit gacutil.exe

32 bit gacutil.exe can install/uninstall/enumerate 64 bit assemblies for GAC, so there is really no...

Author: Junfeng Zhang Date: 07/19/2007

Unknown exception 0xe0434f4e

If you attach windows debugger to a .Net framework application, occasionally you may see debug spew...

Author: Junfeng Zhang Date: 07/16/2007

BadImageFormatException maybe thrown when loading a valid assembly

We saw some cases when loading a perfect valid assembly, CLR may throw BadImageFormatException...

Author: Junfeng Zhang Date: 07/11/2007

Reverse P/Invoke Marshaling Performance

Platform Invoke allows managed code to call unmanaged functions exported by an DLL. While the...

Author: Junfeng Zhang Date: 07/09/2007

Break on exception in Windows Debugger

In Windows Debugger, we can break on C++ exception by doing "sxe eh". We can also break on CLR...

Author: Junfeng Zhang Date: 07/05/2007

RT_MANIFEST resource, and ISOLATION_AWARE_ENABLED

RT_MANIFEST Since Windows XP, Windows reserves a new type of resource RT_MANIFEST for SxS manifests....

Author: Junfeng Zhang Date: 06/26/2007

Diagnose SideBySide failures in Windows XP/Windows Server 2003

Since I published my article on how to diagnose SideBySide failures, I have received many feedbacks...

Author: Junfeng Zhang Date: 06/12/2007

Activation Context Creation flow

The following describes how activation context is created currently in Windows XP/Windows Server...

Author: Junfeng Zhang Date: 06/12/2007

Genman32 – A tool to generate Sxs manifest for managed assembly for Registration Free COM/.Net Interop

Attached to this article is GenMan32, a tool to generate sxs manifest for managed assembly to use in...

Author: Junfeng Zhang Date: 04/14/2007

Connect Kernel Debugger to a Virtual PC/Virtual Server virtual machine

Virtual Machine completely changes how people test software (Well, definitely me.). Create a virtual...

Author: Junfeng Zhang Date: 04/04/2007

Understand why your computer restarted unexpectedly

Many people have experienced unexpected computer restarts. Unexpected restarts can be caused by bugs...

Author: Junfeng Zhang Date: 03/23/2007

Next>