What do we mean by intrinsic?
Most functions are contained in libraries, but some functions are built in (that is, intrinsic) to the compiler. These are referred to as intrinsic functions or intrinsics.
Taken from MSDN…
The __noop intrinsic specifies that a function should be ignored and the argument list be parsed but no code be generated for the arguments. It is intended for use in global debug functions that take a variable number of arguments.
The compiler converts the __noop intrinsic to 0 at compile time. The following code shows how you could use __noop.
// compiler_intrinsics__noop.cpp
// compile with or without /DDEBUG
#include <stdio.h>
#if DEBUG
#define PRINT printf_s
#else
#define PRINT __noop
#endif
int main()
{
PRINT("\nhello\n");
}
So if you have custom macros which should expand to nought in release version the proper way to do this would be via __noop. Remember this is Microsoft(R) specific.
You have a managed application crash dump and you would like to load sos.dll, to use the powerful commands it provides to help with managed debugging, but the load of sos.dll always fails. The command that you are executing for loading sos.dll is…
0:015> .loadby sos clr
Unable to find module ‘clr’
On enter you see the above error and you are not sure what is going on. So in order to understand the error message it is important to understand what .loadby command does.
“.loadby sos clr” means load sos.dll from where clr.dll is loaded. So as you might have guessed by now if clr.dll is not loaded then sos.dll cannot be found. This is what the error means when it says “Unable to find module ‘clr’”. All it means is clr.dll is not in the loaded module list which means there is no path to locate clr.dll.
So how can I fix this error? In order to fix this error you must understand that clr.dll has been introduced into .net applications from .net 4.0 and prior to that we used to have mscorwks.dll. So if your .net application is not a 4.0 app then clr.dll won’t be loaded, yes you will have to use mscorwks.dll instead…
0:015> .loadby sos mscorwks
But you are damn sure that the application that crashed is a .net 4.0 application but you still see the error! All I can say is clr.dll is not loaded. Wait for it to load or break on its load and then execute .loadby sos clr.
So how to break on a module load…
0:015> sxe ld clr
This will for sure help!
Are you having trouble converting VB6 project to VB.net Visual Studio 2010. Well just to be frank you should have long back converted this VB6 project of yours to VB.net. VB6 is ancient and just because your code works doesn’t mean that you won’t migrate it to a newer platform. In my opinion let your customers use the VB6 project of yours while you in the background should have converted a copy of it to VB.net. Now you might say it’s too much work… well how about it now.
Just to be clear Visual Studio 2010 does NOT inherently support converting VB6 project to VB.net 2010. When I force a conversion (via project open dialog) I get the following error dialog…
Recently Mr. X asked me this question so I sent him an email with the steps on converting a VB6 project to VB.net Visual Studio 2010. So here are the steps (straight from the email I sent to the customer…)
- Make sure VB 6.0 with SP 6.0 installed on the machine.
- Make sure that all the referenced components (ActiveX dll, OCX) for the VB 6.0 application is available on the machine.
- Open the VB 6.0 project in VB 6.0 IDE and make sure that it opens fine. Build the project and make sure that the application executes without any errors.
- Run the Upgrade assessment tool on the visual basic 6 project:
(Old one) http://www.microsoft.com/downloads/details.aspx?FamilyId=10C491A2-FC67-4509-BC10-60C5C039A272&displaylang=en
(New one) http://www.artinsoft.com/visual-basic-upgrade-assessment-tool.aspx - Keep a local copy of the VB 6.0 project
- There is no direct wizard conversion in Visual Studio 2010. You have to first use the conversion wizard available in Visual Studio 2005/2008 to convert to VB.net and then convert the same to Visual Studio 2010. As you don’t have Visual Studio 2008, you can download free version from following link.
http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express - Once you are done with the conversion you can uninstall Visual Studio 2008 express edition.
- Also you can download a free guide which contains information about Upgrading Visual Basic 6.0 Applications to Visual Basic .NET and Visual Basic 2005 (Its bit old but it will give useful insights as and when you are migrating source code to .net).
http://www.microsoft.com/downloads/details.aspx?FamilyId=7C3FE0A9-CBED-485F-BFD5-847FB68F785D&displaylang=en
A general note:
As per the upgrade guide, the effect of the changes and subtle differences in Visual Basic .NET is that, unlike previous versions of Visual Basic, most real-world projects cannot be upgraded 100 percent automatically. To understand why, consider that for a 100 percent upgrade there has to be a one-to-one correlation between every element of Visual Basic 6 and a corresponding element in Visual Basic .NET. Unfortunately, this correlation does not exist. The upgrade process is closer to 95 percent, meaning that the Visual Basic .NET Upgrade Wizard upgrades 95 percent of your application, and you modify 5 percent of the application to get it working. What does 5 percent mean? If it took you 100 days to write the original Visual Basic 6 application, you might expect to take 5 days to upgrade it. This number is not set in stone-some applications are easier to upgrade than others, and the experience of the person doing the upgrade is an important factor. To prepare yourself, make sure you familiarize yourself with Part IV of the upgrade guide. It discusses how to design your Visual Basic 6 applications to make the upgrade process much smoother.
Microsoft Visual Basic 6.0 Migration Resource Center
http://msdn.microsoft.com/hi-in/vbrun/ms788233(en-us).aspx
There’s a new C++ Standard and a new version of Visual C++, and it’s time to reveal those features. Read more here…
http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx
Found a nice article which describes how to take native/managed crash dumps automatically using CDB as soon as a crash takes place. We know that for CLR 2.0 we’ve got to configure crash handler settings at two places in the registry for a native and managed application.
For native
- HKLM\Software\Microsoft\Windows NT\Current Version\AeDebug\Debugger
- HKLM\Software\Microsoft\Windows NT\Current Version\AeDebug\Auto
For managed
- HKLM\Software\Microsoft\.NETFramework\DbgManagedDebugger
- HKLM\Software\Microsoft\.NETFramework\DbgJITDebugLaunchSetting
This article from MSDN explains in detail on how to configure registry entries to take automatic crash dumps using CDB…
Read the following article in MSDN:
http://msdn.microsoft.com/en-us/library/5hs4b7a6.aspx
The easiest way to disable JIT debugger is via the Tools->Options dialog in Visual Studio. For other options read the article.
Recently a customer of mine faced this issue. So he had an ActiveX control and when displaying the ActiveX control in browser a string is displayed right in the middle of the control: “ATL 9.0″.
So this issue happens because you didn’t override CComControlBase::OnDraw function. The default code for CComControlBase::OnDraw looks like the following…
HRESULT CComControlBase::YourClassName::OnDraw(_In_ ATL_DRAWINFO& di)
{
::SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
LPCTSTR pszText = _T("ATL ") _T(_ATL_VER_RBLD); // "ATL 9.0"
::TextOut(di.hdcDraw,
di.prcBounds->left + (di.prcBounds->right - di.prcBounds->left) / 2,
di.prcBounds->top + (di.prcBounds->bottom - di.prcBounds->top) / 2,
pszText,
lstrlen(pszText));
return S_OK;
}
MSDN documentation for CComControlBase::OnDraw function confirms this behavior. Quote…
The wizard’s default OnDraw draws a rectangle with the label “ATL 8.0″.The solution for this is to override CComControlBase::OnDraw function in your derived class and provide your own drawing or just return S_OK.


