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 Server 2003 and later, the order is reversed.  Internal manifest is preferred over external manifest. If you use external…

3

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 For example, #define FUSION_E_REF_DEF_MISMATCH       EMAKEHR(0x1040)     // The located assembly’s manifest definition does not match…

3

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();         try         {             DoWork();             success = true;            …

6