Sign in
Junfeng Zhang's Windows Programming Notes
Win32, Fusion, CLR, .Net Framework, and others
Options
RSS for Posts
Atom
RSS for Comments
OK
Search
Advanced search options...
Search In:
Everything
Blogs
Forums
People
Groups
Places
Pages
Date range:
All Time
Last Year
Last 6 Months
Last 3 Months
Last Month
Last Week
Last Two Days
Search
Tags
.NetFramework
Debugging
Fusion
General
Others
Pages
Troubleshooting
Vista
Win32
Archive
Archives
July 2009
(1)
May 2009
(1)
March 2009
(1)
February 2009
(1)
December 2008
(2)
November 2008
(1)
August 2008
(2)
July 2008
(2)
June 2008
(2)
April 2008
(4)
March 2008
(2)
February 2008
(4)
January 2008
(1)
November 2007
(3)
October 2007
(1)
September 2007
(1)
August 2007
(5)
July 2007
(9)
June 2007
(3)
April 2007
(2)
March 2007
(3)
February 2007
(1)
January 2007
(2)
December 2006
(2)
November 2006
(4)
October 2006
(6)
September 2006
(5)
August 2006
(8)
July 2006
(2)
May 2006
(2)
April 2006
(12)
March 2006
(9)
February 2006
(5)
January 2006
(2)
December 2005
(10)
November 2005
(7)
October 2005
(2)
September 2005
(3)
August 2005
(1)
July 2005
(6)
June 2005
(8)
May 2005
(17)
April 2005
(9)
March 2005
(6)
February 2005
(9)
December 2004
(7)
November 2004
(12)
October 2004
(16)
September 2004
(16)
August 2004
(15)
July 2004
(10)
May 2004
(6)
April 2004
(14)
March 2004
(19)
February 2004
(39)
January 2004
(6)
MSDN Blogs
>
Junfeng Zhang's Windows Programming Notes
Posts
Subscribe via RSS
Sort by:
Most Recent
|
Most Views
|
Most Comments
Excerpt View
|
Full Post View
Junfeng Zhang's Windows Programming Notes
Getting where the exception is thrown in Windows Error Report for managed application without a dump
Posted
Mon, Jul 27 2009
by
junfeng
0
Comments
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...
Junfeng Zhang's Windows Programming Notes
Internal Manifest vs External Manifest
Posted
Mon, May 11 2009
by
junfeng
3
Comments
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...
Junfeng Zhang's Windows Programming Notes
CLR HRESULT
Posted
Mon, Mar 2 2009
by
junfeng
3
Comments
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...
Junfeng Zhang's Windows Programming Notes
Be careful about exception after resource allocation
Posted
Mon, Feb 2 2009
by
junfeng
6
Comments
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...
Junfeng Zhang's Windows Programming Notes
Exception Filter
Posted
Mon, Dec 8 2008
by
junfeng
7
Comments
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...
Junfeng Zhang's Windows Programming Notes
ThreadPool.BindHandle
Posted
Mon, Dec 1 2008
by
junfeng
8
Comments
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...
Junfeng Zhang's Windows Programming Notes
ThreadPool.UnsafeQueueNativeOverlapped
Posted
Mon, Nov 24 2008
by
junfeng
3
Comments
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...
Junfeng Zhang's Windows Programming Notes
Conversion between System.String and char *
Posted
Mon, Aug 11 2008
by
junfeng
3
Comments
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...
Junfeng Zhang's Windows Programming Notes
XXX is not a valid Win32 application
Posted
Mon, Aug 4 2008
by
junfeng
1
Comments
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...
Junfeng Zhang's Windows Programming Notes
Managed ThreadPool vs Win32 ThreadPool (pre-Vista)
Posted
Mon, Jul 21 2008
by
junfeng
5
Comments
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...
Junfeng Zhang's Windows Programming Notes
Managed Watson Dump
Posted
Mon, Jul 14 2008
by
junfeng
1
Comments
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...
Junfeng Zhang's Windows Programming Notes
Inspect a 32 bit Process Dump Generated by a 64 bit Debugger
Posted
Mon, Jun 30 2008
by
junfeng
2
Comments
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...
Junfeng Zhang's Windows Programming Notes
Getting a Full Memory Dump for a Process
Posted
Thu, Jun 19 2008
by
junfeng
0
Comments
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...
Junfeng Zhang's Windows Programming Notes
Event Handles “leak”
Posted
Mon, Apr 28 2008
by
junfeng
3
Comments
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...
Junfeng Zhang's Windows Programming Notes
Use !htrace to debug handle leak
Posted
Mon, Apr 21 2008
by
junfeng
3
Comments
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...
Junfeng Zhang's Windows Programming Notes
Consider Creating a new class for locking
Posted
Mon, Apr 14 2008
by
junfeng
5
Comments
C# provides keyword lock for synchronized access. A good practice is to create a private object for locking purpose. For example, public class LockExample { private object syncObject = new object (); public void SynchronizedMethod() { lock (syncObject...
Junfeng Zhang's Windows Programming Notes
A case study of a NullReferenceException
Posted
Mon, Apr 7 2008
by
junfeng
3
Comments
We are seeing a NullReferenceException in our stress program. The investigation process may be helpful to some folks. Thread 22 is showing a Watson dialog. This is a register corruption. 0:022> kp ChildEBP RetAddr 091bc9a0 76961220 ntdll!ZwWaitForSingleObject...
Junfeng Zhang's Windows Programming Notes
App Config’s root element should be namespace-less
Posted
Mon, Mar 24 2008
by
junfeng
0
Comments
The root element for Application config file is <configuration> <?xml version="1.0" encoding="utf-8" ?> <configuration > </configuration> The application config file is shared with CLR and Windows SxS. SxS dictates...
Junfeng Zhang's Windows Programming Notes
Getting the right exception context from a memory dump
Posted
Mon, Mar 3 2008
by
junfeng
1
Comments
When debug a memory dump, the dump may not in the right exception context when it is first loaded in the debugger. However, we can figure out the right context from the dump. Let's load the dump. c:\debuggers>cdb -z c:\temp\foo.dmp Symbol search path...
Junfeng Zhang's Windows Programming Notes
Calculating the size of each GC generation
Posted
Mon, Feb 25 2008
by
junfeng
2
Comments
Sos.dll does not have a command to tell the size of each GC generation. However, you can calculate the size based on the output of !eeheap -gc. For example, 0:000> !eeheap -gc Number of GC Heaps: 1 generation 0 starts at 0x1da6c430 generation 1 starts...
Junfeng Zhang's Windows Programming Notes
Figuring out object allocation graph from a managed memory dump
Posted
Thu, Feb 21 2008
by
junfeng
2
Comments
when debugging a managed memory dump, we can use Sos.dll to inspect managed objects inside the dump. for example, we can do !dumpheap to list the managed objects in GC Heap, we can also use !gcroot to figure out the reference path to a particular object...
Junfeng Zhang's Windows Programming Notes
Windows Update Error 0x800A0030
Posted
Mon, Feb 18 2008
by
junfeng
2
Comments
The other day my Windows XP machine suddenly can not use Windows Update. Internet Explorer went to the Windows Update web site, but stucked in loading the ActiveX control. Nothing is shown, and no progress is made. After I clicked the Microsoft Update...
Junfeng Zhang's Windows Programming Notes
Windows Performance Tools Kit
Posted
Mon, Feb 11 2008
by
junfeng
3
Comments
Windows Performance Team has released Windows Performance Tools Kit to the Windows SDK for Windows Server 2008 and .NET Framework 3.5. http://www.microsoft.com/whdc/system/sysperf/perftools.mspx This is the same tool Windows team uses to diagnose Windows...
Junfeng Zhang's Windows Programming Notes
Reverse P/Invoke and exception
Posted
Mon, Jan 28 2008
by
junfeng
3
Comments
P/Invoke is managed code executing a native function pointer. And Reverse P/Invoke is native code executing a managed delegate as a function pointer, mostly as a callback. When the native code executes the managed delegate function pointer, the call really...
Junfeng Zhang's Windows Programming Notes
From Unhandled Exception to Debugger Attach
Posted
Mon, Nov 19 2007
by
junfeng
1
Comments
I was always wondering what is happening between an application throws an unhandled exception, and a debugger attached to the process. Apparently the information is right under my nose, but I was blind. Windows Debugger's documentation about post-mortem...
Page 1 of 14 (349 items)
1
2
3
4
5
»