tags:

views:

89

answers:

1

I have an ISAPI extension DLL written in C++ using Microsoft Visual Studio 2003 running in IIS 5.1 on XP Pro. Whenever an _ASSERTE fires I just get a an empty message box with 'Error' in the title bar and Abort/Retry/Ignore buttons. What I don't see is any of the expression text from the _ASSERTE macro. I've traced into the runtime library source code and I end up in crtmbox.c at a line which looks like it's calling a dynamically loaded MessageBoxA(). lpText (Debug Assertion Failed ...) and lpCaption (Microsoft Visual C++ Debug Library) are valid.

    return (*pfnMessageBoxA)(hWndParent, lpText, lpCaption, uType);

If I'm debugging the IIS process then the Retry button breaks into the debugger. If I execute the same code from a Windows executable built from the same source then I get the Assert message box I would expect.

I'm sure I've seen this this working in the past. In fact, moving to Visual Studio 2003 originally helped as the 2003 runtime library correctly adds MB_SERVICE_NOTIFICATION to the MessageBox flags so that at least the resulting message box is visible on the console while debugging the service.

Anyone have any ideas?

JF

A: 

I have no solution for you, only a suggestion for investigation. Once you did Retry to drop in the debugger, have you looked at the call stack to see the context in which the assert occurs?

Oh, I looked closely at _ASSERTE and it relies on _CRT_WIDE to pass the message string. If there was a mismatch between the way _ASSERTE was compiled (with wide strings) and the dynamically load pfnMessageBoxA (looks like it is the 'narrow' string type), when the message string would look like a zero-length string. DevStudio 2003 defaults its projects to wide strings you know.

Philippe Payant