VS2010 : Unable to Hit Breakpoints in Managed Code

In Visual Studio 2010, if you are debugging a native executable which in turn loads a managed DLL built against  a version of the framework previous to version 4, you may find that breakpoints which are set in the managed code are not hit. The breakpoints are displayed correctly, you just never hit them when executing…

5

Troubleshooting startup issues with managed application having Authenticode signature

Authenticode, also referred as a “digital signature”, is an industry standard of verifying the source of an application by setting up a trust relationship with the publisher of the application. However, digitally signing your managed application might cost you in terms of application startup time. Following are the facts: 1.       When the CLR loads an…

5

Removing the Frame Caption when Using CMFCVisualManagerOffice2007

When BCGSoft created the classes that Microsoft incorporated as the “MFC Feature Pack” in VS 2008 (and included in SP1), it seems their primary intent was to provide a nearly hands-free implementation of several popularly-requested user interface features.  Especially with the “Visual Manager” classes (derived from CMFCVisualManager), it’s clear that the intent was to easily…

5

Troubleshooting MFC state related issues

In this article we will be talking about MFC Module state and Thread state , and how do we troubleshoot issues related to Module state mismatch. Why MFC dll does needs a module-specific state? Well reason is MFC is a shared dll, it needs to be shared between various modules (dlls\exe) that are linked with…

4

Why autoexp.dat data visualizer entries are ignored at times

We had a customer who had issues with autoexp.dat. He added few data visualizers in autoexp.dat file but somehow none of them took effect in the debugger windows like Autos, Locals, etc. We initially thought the issue is with the way he gave format specifier in autoexp.dat file. After several corrections/trials nothing seemed to take effect….

4

MFC app main window activation/deactivation painting issue

To reproduce this issue please follow these steps… Enable a non-Aero theme like Windows 7 Basic theme Create a new MFC application. Please make sure you’ve selected “Windows 7” for visual style and colors. Also you might notice that the issue is only reproducible when the application runs for the first time on a machine….

4

Stack Corruption: Calling convention mismatch

Stack is one of the most widely understood data structures in computer science. It is a general purpose data structure and is a part of most of modern day computer architectures as well. In the context of a thread running in an executing process, “the stack” is the memory specifically given to that thread for…

4

JIT Debugging using Visual Studio may fail when trying to debug a Session 0 Process on Windows 8

When you try to JIT debug a Session 0 process (like a windows service) on Windows 8 using Visual Studio Debugger, you may find it fails to launch the debugger and see below error in the Application Event Log "Just-In-Time debugging this exception failed with the following error: The operation attempted is not supported". The…

4

Marshalling Complicated Structures using PInvoke

This article talks about marshaling structures using PInvoke which has a pointer to an array of another structure as a member. When calling native functions in a managed application, a frequent question that comes to mind is how to marshal a nested complicated structure.  Recently I came across a scenario where we have to marshal…

3

Switching between CMFCRibbonBar based Ribbon interface and CMFCMenuBar/CMFCToolBar based interface on-the-fly

Download sample project – MFCRibbonToolBarDemo Since the advent of MFC Feature Pack, Ribbon bar based interfaces have been extremely popular as well as useful. However, there might be some scenarios/use-cases when one would want to have both the interfaces i.e. the traditional Menu/Toolbar based interface as well as the modern Ribbon bar based interface in…

3